Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug ChanVariable for asterisk 11 and early #25

Open
romkazor opened this issue Sep 17, 2018 · 2 comments
Open

bug ChanVariable for asterisk 11 and early #25

romkazor opened this issue Sep 17, 2018 · 2 comments

Comments

@romkazor
Copy link
Contributor

romkazor commented Sep 17, 2018

Hello, in some early version of asterisk ChanVariable looks a little differently, and event parser show only last ChanVariable (only CDR(dst)=102). In later version of asterisk event parser show dict of ChanVariable. How can I fix this?

Asterisk 11 (bug)

Event: Hangup
...
ChanVariable(Local/101@from-internal-00000023;1): CDR(dcontext)=from-internal
ChanVariable(Local/101@from-internal-00000023;1): CDR(dst)=101
ChanVariable(Local/102@from-internal-00000023;2): CDR(dcontext)=from-internal
ChanVariable(Local/102@from-internal-00000023;2): CDR(dst)=102

Asterisk 12+ (ok)

Event: Hangup
...
ChanVariable: CDR(dcontext)=from-internal
ChanVariable: CDR(dst)=101
DestChanVariable: CDR(dcontext)=from-internal
DestChanVariable: CDR(dst)=102
@romkazor romkazor changed the title bug in asterisk 11 and early bug for asterisk 11 and early Sep 17, 2018
@romkazor romkazor changed the title bug for asterisk 11 and early bug ChanVariable for asterisk 11 and early Sep 17, 2018
@romkazor
Copy link
Contributor Author

romkazor commented Sep 18, 2018

I wrote ugly fix, but it works, in event.py after 39 string:

before:

try:
                (key, value) = lines[i].split(': ', 1)
                if key in Event.parsers:

after:

try:
                chanvaris = 'ChanVariable'
                if lines[i].find('Channel: ') != -1:
                    channel = lines[i].split(': ')[1]
                if lines[i].find('): ') != -1:
                    chanvar = lines[i].split('): ')[0].split('(')[1]
                    if chanvar != channel:
                        chanvaris = 'DestChanVariable'
                if chanvaris != 'DestChanVariable':
                    (key, value) = re.sub(r'\([^)]*\)\:', ':', lines[i]).split(': ', 1)
                else:
                    (key, value) = re.sub(r'ChanVariable\([^)]*\)\:', 'DestChanVariable:', lines[i]).split(': ', 1)
                if key in Event.parsers:

@ettoreleandrotognoli
Copy link
Owner

I will think about it and try to do something.
Probabily I will delay, I'm busy with the work, but as soon as possible I will work at this.
Thanks for the bug report and for the suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants