[Freeswitch-dev] Missing Header in SIP Message

Brian West brian at freeswitch.org
Mon Oct 6 17:06:18 MSD 2014


Look at mod_sofia.c:

case SWITCH_EVENT_SEND_MESSAGE:

On Tue, Sep 30, 2014 at 7:41 AM, Ronnie Beck <rony at 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 at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at 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 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20141006/8c674fe2/attachment.html 


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