<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello Freeswitch Gurus!<br>
<br>
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:
<a class="moz-txt-link-freetext" href="http://wiki.snom.com/Category:HowTo:XML_SIP_Settings">http://wiki.snom.com/Category:HowTo:XML_SIP_Settings</a><br>
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:<br>
<br>
Event: snom-settings<br>
Content-Type: application/xml<br>
<br>
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?<br>
<br>
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.<br>
<br>
Many thanks in advance,<br>
<br>
Ronnie<br>
<br>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<br>
Code:<br>
<br>
<code><font color="#3f7f5f"><font style="font-size: 10pt" size="2">//Send
the
configuration </font></font></code><code><br>
</code><code>
</code><code><font color="#7f0055"><font style="font-size: 10pt"
size="2"><b>if</b></font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">
(switch_event_create(&event, </font></font></code><code><font
color="#0000c0"><font style="font-size: 10pt" size="2"><i>SWITCH_EVENT_SEND_MESSAGE</i></font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">)
== </font></font></code><code><font color="#0000c0"><font
style="font-size: 10pt" size="2"><i>SWITCH_STATUS_SUCCESS</i></font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">)</font></font></code><code></code><code></code><code><br>
</code><code><font color="#000000"><font style="font-size: 10pt"
size="2"> {</font></font></code><code></code><code></code><code></code><code><br>
</code><code><font color="#000000"><font style="font-size: 10pt"
size="2"> </font></font></code><code><font color="#642880"><font
style="font-size: 10pt" size="2"><b>
switch_event_add_header_string</b></font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">(event,
</font></font></code><code><font color="#0000c0"><font
style="font-size: 10pt" size="2"><i>SWITCH_STACK_BOTTOM</i></font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">,
</font></font></code><code><font color="#2a00ff"><font
style="font-size: 10pt" size="2">"user"</font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">,user);</font></font></code><code></code><code></code><code><br>
</code><code><font color="#000000"><font style="font-size: 10pt"
size="2"> </font></font></code><code><font color="#642880"><font
style="font-size: 10pt" size="2"><b>
switch_event_add_header_string</b></font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">(event,
</font></font></code><code><font color="#0000c0"><font
style="font-size: 10pt" size="2"><i>SWITCH_STACK_BOTTOM</i></font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">,
</font></font></code><code><font color="#2a00ff"><font
style="font-size: 10pt" size="2">"host"</font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">,</font></font></code><code><font
color="#2a00ff"><font style="font-size: 10pt" size="2">"10.0.0.23"</font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">);</font></font></code><code></code><code></code><code><br>
</code><code><font color="#000000"><font style="font-size: 10pt"
size="2"> </font></font></code><code><font color="#642880"><font
style="font-size: 10pt" size="2"><b>
switch_event_add_header_string</b></font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">(event,
</font></font></code><code><font color="#0000c0"><font
style="font-size: 10pt" size="2"><i>SWITCH_STACK_BOTTOM</i></font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">,
</font></font></code><code><font color="#2a00ff"><font
style="font-size: 10pt" size="2">"profile"</font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">,</font></font></code><code><font
color="#2a00ff"><font style="font-size: 10pt" size="2">"internal"</font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">);</font></font></code><code></code><code></code><code><br>
</code><code><font color="#000000"><font style="font-size: 10pt"
size="2"> </font></font></code><code><font color="#642880"><font
style="font-size: 10pt" size="2"><b>
switch_event_add_header_string</b></font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">(event,
</font></font></code><code><font color="#0000c0"><font
style="font-size: 10pt" size="2"><i>SWITCH_STACK_BOTTOM</i></font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">,
</font></font></code><code><font color="#2a00ff"><font
style="font-size: 10pt" size="2">"Subject"</font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">,</font></font></code><code><font
color="#2a00ff"><font style="font-size: 10pt" size="2">"buttons"</font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">);</font></font></code><code></code><code></code><code><br>
</code><code><font color="#000000"><font style="font-size: 10pt"
size="2"> returnValue
= </font></font></code><code><font color="#642880"><font
style="font-size: 10pt" size="2"><b>switch_event_add_header_string</b></font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">(event,
</font></font></code><code><font color="#0000c0"><font
style="font-size: 10pt" size="2"><i>SWITCH_STACK_BOTTOM</i></font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">,
</font></font></code><code><font color="#2a00ff"><font
style="font-size: 10pt" size="2">"Event"</font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">,</font></font></code><code><font
color="#2a00ff"><font style="font-size: 10pt" size="2">"</font></font></code><code><font
color="#2a00ff"><font style="font-size: 10pt" size="2"><u>snom</u></font></font></code><code><font
color="#2a00ff"><font style="font-size: 10pt" size="2">-settings"</font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">);</font></font></code><code></code><code></code><code><br>
</code><code><font color="#000000"><font style="font-size: 10pt"
size="2"> </font></font></code><code><font color="#642880"><font
style="font-size: 10pt" size="2"><b>
switch_event_add_header_string</b></font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">(event,
</font></font></code><code><font color="#0000c0"><font
style="font-size: 10pt" size="2"><i>SWITCH_STACK_BOTTOM</i></font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">,
</font></font></code><code><font color="#2a00ff"><font
style="font-size: 10pt" size="2">"Content-Type"</font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">,
</font></font></code><code><font color="#2a00ff"><font
style="font-size: 10pt" size="2">"application/</font></font></code><code><font
color="#2a00ff"><font style="font-size: 10pt" size="2"><u>xml</u></font></font></code><code><font
color="#2a00ff"><font style="font-size: 10pt" size="2">"</font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">);</font></font></code><code></code><code></code><code><br>
</code><code><font color="#000000"><font style="font-size: 10pt"
size="2"> </font></font></code><code><font color="#642880"><font
style="font-size: 10pt" size="2"><b> switch_event_add_body</b></font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">(event,
</font></font></code><code><font color="#2a00ff"><font
style="font-size: 10pt" size="2">"<settings>"</font></font></code><code></code><code></code><code><br>
</code><code><font color="#000000"><font style="font-size: 10pt"
size="2"> </font></font></code><code><font color="#2a00ff"><font
style="font-size: 10pt" size="2"> "<phone-settings>"</font></font></code><code><br>
</code><code>
</code><code></code><code><font color="#2a00ff"><font size="2"> .<br>
.<br>
<snip><br>
.<br>
.<br>
</font></font></code><code><font color="#2a00ff"><font
style="font-size: 10pt" size="2"> "</settings>"</font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">);</font></font></code><code><br>
</code><code>
</code><code><font color="#000000"><font style="font-size: 10pt"
size="2"> switch_event_fire(&event);</font></font></code><code><br>
</code><code>
</code><code><br>
</code><code>
</code><code><br>
</code><code><font color="#000000"><font style="font-size: 10pt"
size="2"> </font></font></code><code><font color="#7f0055"><font
style="font-size: 10pt" size="2"><b> if</b></font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">(
returnValue != </font></font></code><code><font
color="#0000c0"><font style="font-size: 10pt" size="2"><i>SWITCH_STATUS_SUCCESS</i></font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">
)</font></font></code><code></code><code></code><code><br>
</code><code><font color="#000000"><font style="font-size: 10pt"
size="2"> </font></font></code><code><font color="#642880"><font
style="font-size: 10pt" size="2"><b> switch_log_printf</b></font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">(
SWITCH_CHANNEL_LOG, </font></font></code><code><font
color="#0000c0"><font style="font-size: 10pt" size="2"><i>SWITCH_LOG_INFO</i></font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">,
</font></font></code><code><font color="#2a00ff"><font
style="font-size: 10pt" size="2">"(%s)
Failed to set Event header for user %s.\n"</font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">,
__FUNCTION__, user );</font></font></code><code></code><code></code><code><br>
</code><code><font color="#000000"><font style="font-size: 10pt"
size="2"> </font></font></code><code><font color="#7f0055"><font
style="font-size: 10pt" size="2"><b> else</b></font></font></code><code></code><code></code><code><br>
</code><code><font color="#000000"><font style="font-size: 10pt"
size="2"> </font></font></code><code><font color="#642880"><font
style="font-size: 10pt" size="2"><b> switch_log_printf</b></font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">(
SWITCH_CHANNEL_LOG, </font></font></code><code><font
color="#0000c0"><font style="font-size: 10pt" size="2"><i>SWITCH_LOG_INFO</i></font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">,
</font></font></code><code><font color="#2a00ff"><font
style="font-size: 10pt" size="2">"(%s)
Succeeded to set Event header for user %s.\n"</font></font></code><code><font
color="#000000"><font style="font-size: 10pt" size="2">,
__FUNCTION__, user );</font></font></code><br>
}<br>
<p style="margin-bottom: 0in; line-height: 100%"><br>
</p>
<title></title>
<meta name="generator" content="LibreOffice 4.2.6.3 (Linux)">
<style type="text/css">
        <!--
                @page { margin: 0.79in }
                p { margin-bottom: 0.1in; line-height: 120% }
        -->
        </style><br>
</body>
</html>