John, you should read what he wrote one more time. The code shows precisely what he said. I am going to quote here:<div><br></div><div>"<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">you sent it from mod_commands which chose the dp realm to advertise dp+</span>"</div>
<div><br></div><div>If you _received_ a message from SIP, you would've seen the sip+ prefix and if you sent from the conference module, you would've seen the conf+ prefix on the event. Makes more sense now?</div><div>
<br></div><div>Regards,</div><div><div>Joăo Mesquita<br>
<br><br><div class="gmail_quote">On Thu, Jan 20, 2011 at 12:10 AM, John Rose <span dir="ltr"><<a href="mailto:johnrose@comtex.net">johnrose@comtex.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div lang="EN-US" link="blue" vlink="purple"><div><p> </p><p>Well from <b>switch_core_chat_send</b> it's hardcoded "dp" as the protocol when <b>argv[0]</b> is the actual protocol being passed from the <b>chat</b> API argument.</p>
<p> </p><p><span style="font-size:10.0pt;font-family:Fixedsys;color:green">//-------------------------------------------------------------------------------------------</span></p><p class="MsoNormal" style="text-autospace:none">
<span style="font-size:10.0pt;font-family:Fixedsys">SWITCH_STANDARD_API(chat_api_function)</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys">{</span></p><p class="MsoNormal" style="text-autospace:none">
<span style="font-size:10.0pt;font-family:Fixedsys"> <span style="color:blue">char</span> *lbuf = NULL, *argv[5];</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> <span style="color:blue">int</span> argc = 0;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> </span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> <span style="color:blue">if</span> (!zstr(cmd) && (lbuf = strdup(cmd))</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> && (argc = switch_separate_string(lbuf, <span style="color:#A31515">'|'</span>, argv, (<span style="color:blue">sizeof</span>(argv) / <span style="color:blue">sizeof</span>(argv[0])))) >= 4) {</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> </span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> <span style="color:blue">if</span> (switch_core_chat_send(argv[0], <span style="color:#A31515">"dp"</span>, argv[1], argv[2], <span style="color:#A31515">""</span>, argv[3], !zstr(argv[4]) ? argv[4] : NULL, <span style="color:#A31515">""</span>) == SWITCH_STATUS_SUCCESS) {</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> stream->write_function(stream, <span style="color:#A31515">"Sent"</span>);</span></p><p class="MsoNormal" style="text-autospace:none">
<span style="font-size:10.0pt;font-family:Fixedsys"> } <span style="color:blue">else</span> {</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> stream->write_function(stream, <span style="color:#A31515">"Error! Message Not Sent"</span>);</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> }</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> } <span style="color:blue">else</span> {</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> stream->write_function(stream, <span style="color:#A31515">"Invalid"</span>);</span></p><p class="MsoNormal" style="text-autospace:none">
<span style="font-size:10.0pt;font-family:Fixedsys"> }</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> </span></p><p class="MsoNormal" style="text-autospace:none">
<span style="font-size:10.0pt;font-family:Fixedsys"> switch_safe_free(lbuf);</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> <span style="color:blue">return</span> SWITCH_STATUS_SUCCESS;</span></p>
<p><span style="font-size:10.0pt;font-family:Fixedsys">}</span></p><p><span style="font-size:10.0pt;font-family:Fixedsys;color:green">//-------------------------------------------------------------------------------------------</span></p>
<p> </p><p>Then here in sophia_prescence.c it prepends “dp+” to the sip <b>From</b> URI. The “dp+” can cause issues downstream when the sip <b>MESSAGE</b> is gets routed outbound from the FS box... should be an option to turn it off… </p>
<div class="im"><p> </p><p>From: \"+15186819448\" <<a href="mailto:sip%3Adp%2B%2B15186819448@65.41.13.124" target="_blank">sip:dp++15186819448@65.41.13.124</a>>;tag=FUetK564c4egm\\r\\n</p><p> </p><p> </p></div>
<p>John</p><p> </p><p><span style="font-size:10.0pt;font-family:Fixedsys;color:green">//-------------------------------------------------------------------------------------------</span></p><p class="MsoNormal" style="text-autospace:none">
<span style="font-size:10.0pt;font-family:Fixedsys;color:blue">if</span><span style="font-size:10.0pt;font-family:Fixedsys"> (!strcasecmp(proto, SOFIA_CHAT_PROTO)) {</span></p><p class="MsoNormal" style="text-autospace:none">
<span style="font-size:10.0pt;font-family:Fixedsys"> from = hint;</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> } <span style="color:blue">else</span> {</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> <span style="color:blue">char</span> *fp, *p = NULL;</span></p><p class="MsoNormal" style="text-autospace:none">
<span style="font-size:10.0pt;font-family:Fixedsys"> </span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> fp = strdup(from);</span></p><p class="MsoNormal" style="text-autospace:none">
<span style="font-size:10.0pt;font-family:Fixedsys"> </span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> <span style="color:blue">if</span> (!fp) {</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, <span style="color:#A31515">"Memory Error!\n"</span>);</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> <span style="color:blue">goto</span> end;</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> }</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> </span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> <span style="color:blue">if</span> ((p = strchr(fp, <span style="color:#A31515">'@'</span>))) {</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> *p++ = <span style="color:#A31515">'\0'</span>;</span></p><p class="MsoNormal" style="text-autospace:none">
<span style="font-size:10.0pt;font-family:Fixedsys"> }</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> </span></p><p class="MsoNormal" style="text-autospace:none">
<span style="font-size:10.0pt;font-family:Fixedsys"> <span style="color:blue">if</span> (zstr(p)) {</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> p = profile->domain_name;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> <span style="color:blue">if</span> (zstr(p)) {</span></p><p class="MsoNormal" style="text-autospace:none">
<span style="font-size:10.0pt;font-family:Fixedsys"> p = host;</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> }</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> }</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> </span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> ffrom = switch_mprintf(<span style="color:#A31515">"\"%s\" <sip:%s+%s@%s>"</span>, fp, proto, fp, p);</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> </span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> from = ffrom;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Fixedsys"> switch_safe_free(fp);</span></p><p><span style="font-size:10.0pt;font-family:Fixedsys"> }</span></p><p>
<span style="font-size:10.0pt;font-family:Fixedsys;color:green">//-------------------------------------------------------------------------------------------</span></p><div class="im"><p><span style="font-size:10.0pt;font-family:Fixedsys;color:green"> </span></p>
<p> </p><p> </p><p>> -----Original Message-----</p><p>> From: <a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a> [mailto:<a href="mailto:freeswitch-" target="_blank">freeswitch-</a></p>
<p>> </p><p>> It's not a bug, you are being presumptuous.</p><p>> </p><p>> Every chat interface has a proto prefix that helps FS to route the messages to</p><p>> the right module.</p><p>> you sent it from mod_commands which chose the dp realm to advertise dp+</p>
<p>> </p><p>> if you came in from SIP it is sip+ and conference are conf+ etc.....</p><p>> </p><p>> </p><p>> On Wed, Jan 19, 2011 at 1:43 PM, John Rose <<a href="mailto:johnrose@comtex.net" target="_blank"><span style="color:windowtext;text-decoration:none">johnrose@comtex.net</span></a>> wrote:</p>
<p>> >> -----Original Message-----</p><p>> >> From: John Rose [mailto:<a href="mailto:johnrose@comtex.net" target="_blank">johnrose@comtex.net</a>]</p><p>> >></p><p>> >> Why does the chat API command prefix a "dp+" onto the From URI when I</p>
<p>> >> call the chat API? Here is an argument that I am using:</p><p>> >></p><p>> >></p><p>> "sip|+<a href="mailto:15186819448@65.41.13.124" target="_blank">15186819448@65.41.13.124</a>|external/<a href="mailto:sip%3A%2B12062990047@65.41.13.125" target="_blank">sip:+12062990047@65.41.13.125</a></p>
<p>> >> |</p><p>> >> Test message."</p><p>> >></p><p>> >> Then the From header:</p><p>> >></p><p>> >> From: \"+15186819448\"</p><p>> >> <<a href="mailto:sip%3Adp%2B%2B15186819448@65.41.13.124" target="_blank">sip:dp++15186819448@65.41.13.124</a>>;tag=FUetK564c4egm\\r\\n</p>
<p>> >></p><p>> ></p><p>> ></p><p>> > Argh, after looking through the code I think this is a FS bug where it</p><p>> > was intended for this "dp+" to be prefixed in the Jingle protocol</p>
<p>> > under certain circumstances not SIP.... looks very suspicious...</p><p>> ></p><p>> > John</p><p>> ></p></div></div></div><br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br></div></div>