[Freeswitch-users] Fw: how to get the content of sip header ?
Samira Mh
saami_mh at ymail.com
Tue Jul 3 15:24:29 MSD 2012
thanks Peter,
yes , i have followed the page : http://wiki.freeswitch.org/wiki/Mod_lua/Serving_Configuration
my configurations as follow:
<configuration name="lua.conf" description="LUA Configuration"> <settings> <param name="xml-handler-script" value="register.lua"/> <param name="xml-handler-bindings" value="directory"/> </settings>
</configuration>
in register.lua script , i have authenticared and registered users usig lua script instead of using in-memory method, so the sip header initiatiate in lua script as follow: (i don't now why CSeq/contact/, etc left empty)...
recv 551 bytes from udp/[192.168.18.120]:57916 at 11:02:40.742843:
------------------------------------------------------------------------
REGISTER sip:192.168.10.89 SIP/2.0
Via: SIP/2.0/UDP 192.168.18.120:57916;branch=z9hG4bK-d8754z-7d027150e23ed159-1---d8754z-;rport
Max-Forwards: 70
Contact: <sip:1000 at 192.168.18.120:57916;rinstance=12e37149747f3c4b>
To: <sip:1000 at 192.168.10.89>
From: <sip:1000 at 192.168.10.89>;tag=0e70ba56
Call-ID: NjU3NzZhZjYwNGUxNWZmOTZmN2VjYWI0NTM5NDEyYjE.
CSeq: 1 REGISTER
Expires: 5454
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
Supported: timer
User-Agent: eyeBeam release 1102q stamp 51814
Content-Length: 0
------------------------------------------------------------------------
send 695 bytes to udp/[192.168.18.120]:57916 at 11:02:40.743818:
------------------------------------------------------------------------
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.18.120:57916;branch=z9hG4bK-d8754z-7d027150e23ed159-1---d8754z-;rport=57916
From: <sip:1000 at 192.168.10.89>;tag=0e70ba56
To: <sip:1000 at 192.168.10.89>;tag=KQcaD6Ba9e2te
Call-ID: NjU3NzZhZjYwNGUxNWZmOTZmN2VjYWI0NTM5NDEyYjE.
CSeq: 1 REGISTER
User-Agent: FreeSWITCH-mod_sofia/1.2.0-rc2+git~20120622T231506Z~76fae0cec0+unclean~20120625T042938Z
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, UPDATE, INFO, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, precondition, path, replaces
WWW-Authenticate: Digest realm="192.168.10.89", nonce="9b803030-c4fe-11e1-ad8a-099620eb6996", algorithm=MD5, qop="auth"
Content-Length: 0
------------------------------------------------------------------------
recv 802 bytes from udp/[192.168.18.120]:57916 at 11:02:40.947421:
------------------------------------------------------------------------
REGISTER sip:192.168.10.89 SIP/2.0
Via: SIP/2.0/UDP 192.168.18.120:57916;branch=z9hG4bK-d8754z-8717e047bb6d4d76-1---d8754z-;rport
Max-Forwards: 70
Contact: <sip:1000 at 192.168.18.120:57916;rinstance=12e37149747f3c4b>
To: <sip:1000 at 192.168.10.89>
From: <sip:1000 at 192.168.10.89>;tag=0e70ba56
Call-ID: NjU3NzZhZjYwNGUxNWZmOTZmN2VjYWI0NTM5NDEyYjE.
CSeq: 2 REGISTER
Expires: 5454
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
Supported: timer
User-Agent: eyeBeam release 1102q stamp 51814
Authorization: Digest username="1000",realm="192.168.10.89",nonce="9b803030-c4fe-11e1-ad8a-099620eb6996",uri="sip:192.168.10.89",response="2044cb3f7f932d83402d6a38b26cd5e6",cnonce="2290ee958a69ed51c8bb638ab4341cef",nc=00000001,qop=auth,algorithm=MD5
Content-Length: 0
------------------------------------------------------------------------
2012-07-03 15:32:40.940760 [NOTICE] switch_cpp.cpp:1227 Debug from gen_dir_user_xml.lua, provided params:
'Event-Name: REQUEST_PARAMS
Core-UUID: 83d1034e-c4f2-11e1-ad58-099620eb6996
FreeSWITCH-Hostname: PBX
FreeSWITCH-Switchname: PBX
FreeSWITCH-IPv4: 192.168.10.89
FreeSWITCH-IPv6: %3A%3A1
Event-Date-Local: 2012-07-03%2015%3A32%3A40
Event-Date-GMT: Tue,%2003%20Jul%202012%2011%3A02%3A40%20GMT
Event-Date-Timestamp: 1341313360940760
Event-Calling-File: sofia_reg.c
Event-Calling-Function: sofia_reg_parse_auth
Event-Calling-Line-Number: 2364
Event-Sequence: 3304
action: sip_auth
sip_profile: internal
sip_user_agent: eyeBeam%20release%201102q%20stamp%2051814
sip_auth_username: 1000
sip_auth_realm: 192.168.10.89
sip_auth_nonce: 9b803030-c4fe-11e1-ad8a-099620eb6996
sip_auth_uri: sip%3A192.168.10.89
sip_contact_user: 1000
sip_contact_host: 192.168.18.120
sip_to_user: 1000
sip_to_host: 192.168.10.89
sip_from_user: 1000
sip_from_host: 192.168.10.89
sip_request_host: 192.168.10.89
sip_auth_qop: auth
sip_auth_cnonce: 2290ee958a69ed51c8bb638ab4341cef
sip_auth_nc: 00000001
sip_auth_response: 2044cb3f7f932d83402d6a38b26cd5e6
sip_auth_method: REGISTER
key: id
user: 1000
domain: 192.168.10.89
ip: 192.168.18.120
'
2012-07-03 15:32:40.940760 [INFO] switch_cpp.cpp:1227 profile internal
2012-07-03 15:32:40.940760 [INFO] switch_cpp.cpp:1227 useragent eyeBeam release 1102q stamp 51814
2012-07-03 15:32:40.940760 [INFO] switch_cpp.cpp:1227 username 1000
2012-07-03 15:32:40.940760 [INFO] switch_cpp.cpp:1227 req_auth_realm 192.168.10.89
2012-07-03 15:32:40.940760 [INFO] switch_cpp.cpp:1227 contact_user 1000
2012-07-03 15:32:40.940760 [INFO] switch_cpp.cpp:1227 contact_host 192.168.18.120
2012-07-03 15:32:40.940760 [INFO] switch_cpp.cpp:1227 _to_host 192.168.10.89
2012-07-03 15:32:40.940760 [INFO] switch_cpp.cpp:1227 from_host 192.168.10.89
2012-07-03 15:32:40.940760 [INFO] switch_cpp.cpp:1227 request_host 192.168.10.89
2012-07-03 15:32:40.940760 [INFO] switch_cpp.cpp:1227 req_domain 192.168.10.89
2012-07-03 15:32:40.940760 [INFO] switch_cpp.cpp:1227 req_ip 192.168.18.120
2012-07-03 15:32:40.940760 [INFO] switch_cpp.cpp:1227 <document type="freeswitch/xml">
<section name="directory">
<domain name="192.168.10.89">
<user id="1000">
<params>
<param name="password" value="1000"/>
<param name="vm-password" value="1000"/>
</params>
<variables>
<variable name="user_context" value="default"/>
<variable name="accountcode" value="1000"/>
<variable name="user_context" value="default"/>
<variable name="effective_caller_id_name" value="1000"/>
<variable name="effective_caller_id_number" value="1000"/>
</variables>
</user>
</domain>
</section>
</document>
send 683 bytes to udp/[192.168.18.120]:57916 at 11:02:40.955909:
------------------------------------------------------------------------
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.18.120:57916;branch=z9hG4bK-d8754z-8717e047bb6d4d76-1---d8754z-;rport=57916
From: <sip:1000 at 192.168.10.89>;tag=0e70ba56
To: <sip:1000 at 192.168.10.89>;tag=m052e1vD6QrDa
Call-ID: NjU3NzZhZjYwNGUxNWZmOTZmN2VjYWI0NTM5NDEyYjE.
CSeq: 2 REGISTER
Contact: <sip:1000 at 192.168.18.120:57916;rinstance=12e37149747f3c4b>;expires=5454
Date: Tue, 03 Jul 2012 11:02:40 GMT
User-Agent: FreeSWITCH-mod_sofia/1.2.0-rc2+git~20120622T231506Z~76fae0cec0+unclean~20120625T042938Z
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, UPDATE, INFO, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, precondition, path, replaces
Content-Length: 0
------------------------------------------------------------------------
recv 554 bytes from udp/[192.168.18.120]:57916 at 11:02:41.060557:
------------------------------------------------------------------------
SUBSCRIBE sip:1000 at 192.168.10.89 SIP/2.0
Via: SIP/2.0/UDP 192.168.18.120:57916;branch=z9hG4bK-d8754z-ac23c509701fe314-1---d8754z-;rport
Max-Forwards: 70
Contact: <sip:1000 at 192.168.18.120:57916>
To: <sip:1000 at 192.168.10.89>
From: <sip:1000 at 192.168.10.89>;tag=96753574
Call-ID: Yzg3Y2M4OGNmNDQ3ODhhMjU4OGVhZjE5NDYyOGI4OWE.
CSeq: 1 SUBSCRIBE
Expires: 300
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
Supported: timer
User-Agent: eyeBeam release 1102q stamp 51814
Event: message-summary
Content-Length: 0
------------------------------------------------------------------------
send 805 bytes to udp/[192.168.18.120]:57916 at 11:02:41.061900:
------------------------------------------------------------------------
SIP/2.0 202 Accepted
Via: SIP/2.0/UDP 192.168.18.120:57916;branch=z9hG4bK-d8754z-ac23c509701fe314-1---d8754z-;rport=57916
From: <sip:1000 at 192.168.10.89>;tag=96753574
To: <sip:1000 at 192.168.10.89>;tag=PbULiimW0TlP
Call-ID: Yzg3Y2M4OGNmNDQ3ODhhMjU4OGVhZjE5NDYyOGI4OWE.
CSeq: 1 SUBSCRIBE
Contact: <sip:1000 at 192.168.10.89:5060>
Expires: 300
User-Agent: FreeSWITCH-mod_sofia/1.2.0-rc2+git~20120622T231506Z~76fae0cec0+unclean~20120625T042938Z
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, UPDATE, INFO, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, precondition, path, replaces
Allow-Events: talk, hold, presence, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
Subscription-State: active;expires=300
Content-Length: 0
------------------------------------------------------------------------
send 1030 bytes to udp/[192.168.18.120]:57916 at 11:02:41.064419:
------------------------------------------------------------------------
NOTIFY sip:1000 at 192.168.18.120:57916;rinstance=12e37149747f3c4b SIP/2.0
Via: SIP/2.0/UDP 192.168.10.89;rport;branch=z9hG4bK494QZ0eB01Z4D
Route: <sip:1000 at 192.168.18.120:57916>;rinstance=12e37149747f3c4b
Max-Forwards: 70
From: <sip:1000 at 192.168.10.89>;tag=pjrmjQym094jH
To: <sip:1000 at 192.168.10.89>
Call-ID: 730f6d3e-3fa1-1230-cbb5-005056945e65
CSeq: 30320616 NOTIFY
Contact: <sip:mod_sofia at 192.168.10.89:5060>
User-Agent: FreeSWITCH-mod_sofia/1.2.0-rc2+git~20120622T231506Z~76fae0cec0+unclean~20120625T042938Z
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, UPDATE, INFO, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, precondition, path, replaces
Event: message-summary
Allow-Events: talk, hold, presence, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
Subscription-State: terminated;reason=noresource
Content-Type: application/simple-message-summary
Content-Length: 65
Messages-Waiting: no
Message-Account: sip:1000 at 192.168.10.89
------------------------------------------------------------------------
send 1005 bytes to udp/[192.168.18.120]:57916 at 11:02:41.164620:
------------------------------------------------------------------------
NOTIFY sip:1000 at 192.168.18.120:57916 SIP/2.0
Via: SIP/2.0/UDP 192.168.10.89;rport;branch=z9hG4bK5jyg1UZeXapQS
Route: <sip:192.168.18.120:57916>;transport=udp
Max-Forwards: 70
From: <sip:1000 at 192.168.10.89>;tag=PbULiimW0TlP
To: <sip:1000 at 192.168.10.89>;tag=96753574
Call-ID: Yzg3Y2M4OGNmNDQ3ODhhMjU4OGVhZjE5NDYyOGI4OWE.
CSeq: 286150130 NOTIFY
Contact: <sip:1000 at 192.168.10.89:5060;transport=udp>
User-Agent: FreeSWITCH-mod_sofia/1.2.0-rc2+git~20120622T231506Z~76fae0cec0+unclean~20120625T042938Z
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, UPDATE, INFO, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, precondition, path, replaces
Event: message-summary
Allow-Events: talk, hold, presence, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
Subscription-State: active;expires=300
Content-Type: application/simple-message-summary
Content-Length: 65
Messages-Waiting: no
Message-Account: sip:1000 at 192.168.10.89
------------------------------------------------------------------------
recv 355 bytes from udp/[192.168.18.120]:57916 at 11:02:41.166525:
------------------------------------------------------------------------
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.10.89;rport=5060;branch=z9hG4bK494QZ0eB01Z4D
Contact: <sip:192.168.18.120:57916>
To: <sip:1000 at 192.168.10.89>;tag=2e2a6254
From: <sip:1000 at 192.168.10.89>;tag=pjrmjQym094jH
Call-ID: 730f6d3e-3fa1-1230-cbb5-005056945e65
CSeq: 30320616 NOTIFY
User-Agent: eyeBeam release 1102q stamp 51814
Content-Length: 0
------------------------------------------------------------------------
recv 368 bytes from udp/[192.168.18.120]:57916 at 11:02:41.267410:
------------------------------------------------------------------------
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.10.89;rport=5060;branch=z9hG4bK5jyg1UZeXapQS
Contact: <sip:1000 at 192.168.18.120:57916>
To: <sip:1000 at 192.168.10.89>;tag=96753574
From: <sip:1000 at 192.168.10.89>;tag=PbULiimW0TlP
Call-ID: Yzg3Y2M4OGNmNDQ3ODhhMjU4OGVhZjE5NDYyOGI4OWE.
CSeq: 286150130 NOTIFY
User-Agent: eyeBeam release 1102q stamp 51814
Content-Length: 0
________________________________
From: Peter Olsson <peter.olsson at visionutveckling.se>
To: 'FreeSWITCH Users Help' <freeswitch-users at lists.freeswitch.org>
Sent: Tuesday, July 3, 2012 3:14 PM
Subject: Re: [Freeswitch-users] how to get the content of sip header ?
Is this some kind of xml-generating script for register bindings (as in here: http://wiki.freeswitch.org/wiki/Mod_lua/Serving_Configuration)? If that’s the case, you have no session object, and you will have to follow the information on that wiki page instead.
/Peter
Från:freeswitch-users-bounces at lists.freeswitch.org [mailto:freeswitch-users-bounces at lists.freeswitch.org] För Samira Mh
Skickat: den 3 juli 2012 12:16
Till: FreeSWITCH Users Help
Ämne: Re: [Freeswitch-users] how to get the content of sip header ?
for example i want to read the value of sip-header ' CSeq' in lua(that is configure for mod_xml in /usr/loca/freeswitch/conf/autoload/lia.xml.conf), must to issue as follow:
local var = session:getVariable("sip_CSeq")
but the error occure:
attempt to index global 'session' (a nil value)
REGISTER sip:192.168.10.89 SIP/2.0
Via: SIP/2.0/UDP 192.168.18.120:33648;branch=z9hG4bK-d8754z-7e634b5c7a239f6b-1---d8754z-;rport
Max-Forwards: 70
Contact: <sip:1000 at 192.168.18.120:33648;rinstance=313a890c6a269acd>
To: <sip:1000 at 192.168.10.89>
From: <sip:1000 at 192.168.10.89>;tag=695adb0d
Call-ID: MGUzNTFkZWVlOTcwODBmOWViNGY4MjM3MzE2NTQzMTM.
CSeq: 1 REGISTER
Expires: 5454
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
Supported: timer
User-Agent: eyeBeam release 1102q stamp 51814
Content-Length: 0
________________________________
From:Peter Olsson <peter.olsson at visionutveckling.se>
To: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org>
Sent: Sunday, July 1, 2012 11:33 AM
Subject: Re: [Freeswitch-users] how to get the content of sip header ?
Use session:getVariable("var") to read whatever channel variable you need. As Michael said, the SIP headers are stored like sip_header_name. For instance, to read the header Diversion:, use the variable sip_diversion.
Michael also mentions the info app, which is a good way to dump all channel variables for a channel, so you know exactly what you have available. To use this, just execute the app info in the dialplan.
/Peter
1 jul 2012 kl. 05:47 skrev "Samira Mh" <saami_mh at ymail.com<mailto:saami_mh at ymail.com>>:
is it possible to explain in details? ,i have review the wiki on subject but don't understand clearly, i am new on freeswitch, thanks ...
________________________________
From: Michael Collins <msc at freeswitch.org<mailto:msc at freeswitch.org>>
To: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org<mailto:freeswitch-users at lists.freeswitch.org>>
Sent: Sunday, July 1, 2012 1:33 AM
Subject: Re: [Freeswitch-users] how to get the content of sip header ?
See if you have a bunch of sip_xxx channel variables. Send the call to the info app and see what you've got.
-MC
On Sat, Jun 30, 2012 at 5:57 AM, Samira Mh <saami_mh at ymail.com<mailto:saami_mh at ymail.com>> wrote:
hi,
how to get the content of sip header in lua?
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org<mailto:consulting at freeswitch.org>
http://www.freeswitchsolutions.com<http://www.freeswitchsolutions.com/>
</>
Official FreeSWITCH Sites
http://www.freeswitch.org<http://www.freeswitch.org/>
http://wiki.freeswitch.org<http://wiki.freeswitch.org/>
http://www.cluecon.com<http://www.cluecon.com/>
Join Us At ClueCon - Aug 7-9, 2012
FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org<mailto:FreeSWITCH-users at lists.freeswitch.org>
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org<http://www.freeswitch.org/>
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org<mailto:consulting at freeswitch.org>
http://www.freeswitchsolutions.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com
Join Us At ClueCon - Aug 7-9, 2012
FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org<mailto:FreeSWITCH-users at lists.freeswitch.org>
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
!DSPAM:4fefc4ee32761372387519!
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org
http://www.freeswitchsolutions.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com
Join Us At ClueCon - Aug 7-9, 2012
FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
!DSPAM:4ff2c56532769990114684!
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org
http://www.freeswitchsolutions.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com
Join Us At ClueCon - Aug 7-9, 2012
FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org
http://www.freeswitchsolutions.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com
Join Us At ClueCon - Aug 7-9, 2012
FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120703/0f82d7ab/attachment-0001.html
Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users
mailing list