[asterisk-users] Wrong call information on B leg

Mikhail Lischuk mlischuk at itx.com.ua
Thu Dec 15 05:51:54 CST 2011


 

Greetings. 

I have next feature in features.conf : 

send =>
*9,peer/both,AGI,/etc/asterisk/agi/map_mail.pl 

What it does is parsing
CALLERID and DNID from AGI input, performing some actions in MySQL with
these values, and then running application for peer (for example,
PlayBack) 

Sounds simple, and it really is. When my user is receiving a
call (we are the B leg) and presses *9, everything works perfectly.


However, there is a problem if we are the A leg. For some reason,
variables parsed from AGI input are not real for current call. 

For
example, my SIP user 405 calls PSTN number, let's s say 0442010000, via
PRI. 

AGI debug output in console shows next: 

AGI Tx >> agi_request:
/etc/asterisk/agi/map_mail.pl 
 AGI Tx >> agi_channel: Zap/63-1 
 AGI Tx
>> agi_language: en 
 AGI Tx >> agi_type: Zap 
 AGI Tx >> agi_uniqueid:
1322049810.4307 
 AGI Tx >> agi_callerid: 0442010000 
 AGI Tx >>
agi_calleridname: unknown 
 AGI Tx >> agi_callingpres: 3 
 AGI Tx >>
agi_callingani2: 0 
 AGI Tx >> agi_callington: 0 
 AGI Tx >>
agi_callingtns: 0 
 AGI Tx >> agi_dnid: 481 
 AGI Tx >> agi_rdnis:
unknown 
 AGI Tx >> agi_context: from_pstn 
 AGI Tx >> agi_extension: 

AGI Tx >> agi_priority: 1 
 AGI Tx >> agi_enhanced: 0.0 
 AGI Tx >>
agi_accountcode: 

As we can see here, the DNID and CALLERID are swapped
(idk, maybe it is intended behavior). However, that is not a problem.
The problem is - it shows 481, but we are calling from 405! 

Okay, I
said, I will pass the ${DNID} and ${CALLERID} to my script as
parameters. Then I run SHOW CHANNEL on my B leg (i.e. Zap/63-1, opposed
to SIP/405-somecallid) to see what these variables are, and I see next:


Caller ID: 0442010000 
 Caller ID Name: (N/A) 
 DNID Digits: 408 

(it
is another call, so DNID differs, but it is still not 405) 

As far as I
understand from manuals, by setting "peer" in my features.conf I make
script being launched for the other side from user, who pressed *9 - on
B leg, if the call is outgoing. 

And as I can see from what I get here,
script receives information for its leg - and gets the wrong information
in situation described above. 

The question is - is this really the way
Asterisk works with channel variables, or am I doing something wrong?


And if the problem is me - how can I receive 100% correct information
for current call, not depending on if it is launched on caller or callee
side?

My Asterisk version is Asterisk SVN-branch-1.4-r290100 and I
really hope that I will not have to update it because it will be a long
and hard quest due to old and broken PRI card drivers 8(

Hope for some
wisdom and help. 

-- 
With Best Regards
Mikhail Lischuk

ITX Ukraine
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20111215/0d8461d2/attachment.htm>


More information about the asterisk-users mailing list