[Freeswitch-dev] Missing Header in SIP Message

Ronnie Beck rony at botl.au.com
Tue Sep 30 16:41:45 MSD 2014


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 );|
}



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20140930/37e67953/attachment-0001.html 


Join us at ClueCon 2014 Aug 4-7, 2014
More information about the FreeSWITCH-dev mailing list