[Freeswitch-dev] Missing Header in SIP Message
Hello Freeswitch Gurus! I have a simple problem I am hoping someone might be able to help me with. I want to configure a SNOM phone automagically using SIP messages. The process is described here: http://wiki.snom.com/Category:HowTo:XML_SIP_Settings I have created a Freeswitch module which sends the appropriate SIP message to the phone but I have hit a small snag. In order for this to work, two headers must be set in the SIP message else the SNOM will ignore the request. Those are: Event: snom-settings Content-Type: application/xml I have code which should do that but when I do a packet capture, I can see that the "Event" header is not in the SIP message that is sent. The code I am using is listed below. Is there something obvious that I am doing wrong? According to the output I get in the Freeswitch console from my module, the "Event" header is successfully added to the event, however it isn't present in the SIP message. Many thanks in advance, Ronnie Code: |//Send the configuration || ||||*if*||(switch_event_create(&event, ||/SWITCH_EVENT_SEND_MESSAGE/||) == ||/SWITCH_STATUS_SUCCESS/||)|||||| ||{|||||||| ||||*switch_event_add_header_string*||(event, ||/SWITCH_STACK_BOTTOM/||, ||"user"||,user);|||||| ||||*switch_event_add_header_string*||(event, ||/SWITCH_STACK_BOTTOM/||, ||"host"||,||"10.0.0.23"||);|||||| ||||*switch_event_add_header_string*||(event, ||/SWITCH_STACK_BOTTOM/||, ||"profile"||,||"internal"||);|||||| ||||*switch_event_add_header_string*||(event, ||/SWITCH_STACK_BOTTOM/||, ||"Subject"||,||"buttons"||);|||||| || returnValue = ||*switch_event_add_header_string*||(event, ||/SWITCH_STACK_BOTTOM/||, ||"Event"||,||"||_snom_||-settings"||);|||||| ||||*switch_event_add_header_string*||(event, ||/SWITCH_STACK_BOTTOM/||, ||"Content-Type"||, ||"application/||_xml_||"||);|||||| ||||* switch_event_add_body*||(event, ||"<settings>"|||||| |||| "<phone-settings>"|| |||||| . . <snip> . . || "</settings>"||);|| |||| switch_event_fire(&event);|| |||| |||| ||||* if*||( returnValue != ||/SWITCH_STATUS_SUCCESS/||)|||||| ||||* switch_log_printf*||( SWITCH_CHANNEL_LOG, ||/SWITCH_LOG_INFO/||, ||"(%s) Failed to set Event header for user %s.\n"||, __FUNCTION__, user );|||||| ||||* else*|||||| ||||* switch_log_printf*||( SWITCH_CHANNEL_LOG, ||/SWITCH_LOG_INFO/||, ||"(%s) Succeeded to set Event header for user %s.\n"||, __FUNCTION__, user );| }
Look at mod_sofia.c: case SWITCH_EVENT_SEND_MESSAGE: On Tue, Sep 30, 2014 at 7:41 AM, Ronnie Beck <rony@botl.au.com> wrote:
Hello Freeswitch Gurus!
I have a simple problem I am hoping someone might be able to help me with. I want to configure a SNOM phone automagically using SIP messages. The process is described here: http://wiki.snom.com/Category:HowTo:XML_SIP_Settings I have created a Freeswitch module which sends the appropriate SIP message to the phone but I have hit a small snag. In order for this to work, two headers must be set in the SIP message else the SNOM will ignore the request. Those are:
Event: snom-settings Content-Type: application/xml
I have code which should do that but when I do a packet capture, I can see that the "Event" header is not in the SIP message that is sent. The code I am using is listed below. Is there something obvious that I am doing wrong?
According to the output I get in the Freeswitch console from my module, the "Event" header is successfully added to the event, however it isn't present in the SIP message.
Many thanks in advance,
Ronnie
Code:
//Send the configuration *if* (switch_event_create(&event, *SWITCH_EVENT_SEND_MESSAGE*) == *SWITCH_STATUS_SUCCESS*) { * switch_event_add_header_string*(event, *SWITCH_STACK_BOTTOM*, "user" ,user); * switch_event_add_header_string*(event, *SWITCH_STACK_BOTTOM*, "host" ,"10.0.0.23"); * switch_event_add_header_string*(event, *SWITCH_STACK_BOTTOM*, "profile","internal"); * switch_event_add_header_string*(event, *SWITCH_STACK_BOTTOM*, "Subject","buttons"); returnValue = *switch_event_add_header_string*(event, *SWITCH_STACK_BOTTOM*, "Event","*snom*-settings"); * switch_event_add_header_string*(event, *SWITCH_STACK_BOTTOM*, "Content-Type", "application/*xml*"); * switch_event_add_body*(event, "<settings>" "<phone-settings>" . . <snip> . . "</settings>"); switch_event_fire(&event);
* if*( returnValue != *SWITCH_STATUS_SUCCESS* ) * switch_log_printf*( SWITCH_CHANNEL_LOG, *SWITCH_LOG_INFO*, "(%s) Failed to set Event header for user %s.\n", __FUNCTION__, user ); * else* * switch_log_printf*( SWITCH_CHANNEL_LOG, *SWITCH_LOG_INFO*, "(%s) Succeeded to set Event header for user %s.\n", __FUNCTION__, user ); }
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-dev mailing list FreeSWITCH-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org
-- *Brian West* brian@freeswitch.org *Twitter: @FreeSWITCH , @briankwest* http://www.freeswitchbook.com http://www.freeswitchcookbook.com *T:*+19184209001 | *F:*+19184209002 | *M:*+1918424WEST (9378) *iNUM:*+883 5100 1420 9001 | *ISN:*410*543 | *Skype:*briankwest
participants (2)
-
Brian West
-
Ronnie Beck