[Asterisk-Users] HELP: how to get "To:" from AGI?

Charles Wang lazy.charles at gmail.com
Sun May 8 20:34:06 MST 2005


Hi, ALL:

I use asterisk -rvvvvvvvv and "sip debug" to debug my sip channel.
And I build my sip proxy(5060) and asterisk(5065) on the same machine.

I make a call from 1011 to 9999 on sip proxy, 
sip proxy forwards this call to "0939749001".
And this 0939749001 will be sent to asterisk by sip proxy.

sip ua(1011) => sipproxy => sip ua 9999 ( call forward 0939749001)
                            ||
                            ======> asterisk ===> cisco 5300 ==>
0939749001 (pstn)

I can find $EXTEN is equal to 0939749001 ( a mobile phone number )
and my $CALLERIDNUM is 1011
But how can I get the value of "9999" from "To:" field? ( via this sip ua)
In another word, I want to record the "middle" man.

My extensions.conf :
------------------------------------------------------------------------------------------------------------------------
exten => _.,1,Answer
exten => _.,2,DeadAGI(astcc.agi,${CALLERIDNUM},${EXTEN})
exten => _.,3,Hangup
------------------------------------------------------------------------------------------------------------------------

My log on asterisk CLI:
============================================================
   -- Executing DeadAGI("SIP/61.220.xxx.xxx-081888c8",
"astcc.agi|1011|0939749001|4") in new stack
   -- Launched AGI Script /var/lib/asterisk/agi-bin/astcc.agi
ser*CLI>
<-- SIP read from 61.220.xxx.xxx:5060:
ACK sip:0939749001 at 61.220.xxx.xxx:5065 SIP/2.0
Record-Route: <sip:61.220.xxx.xxx;ftag=915860198;lr=on>
Via: SIP/2.0/UDP 61.220.xxx.xxx;branch=0
Via: SIP/2.0/UDP
220.134.18.190:47286;rport=47286;branch=z9hG4bKB90B5F6F80294C48AACF7BDE31B9D2F1
From: 1011 <sip:1011 at 61.220.xxx.xxx>;tag=915860198
To: <sip:9999 at 61.220.xxx.xxx>;tag=as1c0a7e38    <=== I want to get this value
Contact: <sip:1011 at 220.134.xxx.xxx:47286>
Call-ID: 697AFAC3-F5D0-4297-811E-EE32728503AF at 192.168.1.2
CSeq: 57194 ACK
Max-Forwards: 16
Content-Length: 0
============================================================


-- 

Best Regards
Charles



More information about the asterisk-users mailing list