[Freeswitch-users] dp+ prefixed on From URI

John Rose johnrose at comtex.net
Thu Jan 20 06:10:18 MSK 2011


 

Well from switch_core_chat_send it's hardcoded "dp" as the protocol when
argv[0] is the actual protocol being passed from the chat API argument.

 

//--------------------------------------------------------------------------
-----------------

SWITCH_STANDARD_API(chat_api_function)

{

      char *lbuf = NULL, *argv[5];

      int argc = 0;

 

      if (!zstr(cmd) && (lbuf = strdup(cmd))

            && (argc = switch_separate_string(lbuf, '|', argv, (sizeof(argv)
/ sizeof(argv[0])))) >= 4) {

 

            if (switch_core_chat_send(argv[0], "dp", argv[1], argv[2], "",
argv[3], !zstr(argv[4]) ? argv[4] : NULL, "") == SWITCH_STATUS_SUCCESS) {

                  stream->write_function(stream, "Sent");

            } else {

                  stream->write_function(stream, "Error! Message Not Sent");

            }

      } else {

            stream->write_function(stream, "Invalid");

      }

 

      switch_safe_free(lbuf);

      return SWITCH_STATUS_SUCCESS;

}

//--------------------------------------------------------------------------
-----------------

 

Then here in sophia_prescence.c  it prepends "dp+" to the sip From URI.  The
"dp+" can cause issues downstream when the sip MESSAGE is gets routed
outbound from the FS box... should be an option to turn it off. 

 

From: \"+15186819448\"
<sip:dp++15186819448 at 65.41.13.124>;tag=FUetK564c4egm\\r\\n

 

 

John

 

//--------------------------------------------------------------------------
-----------------

if (!strcasecmp(proto, SOFIA_CHAT_PROTO)) {

            from = hint;

      } else {

            char *fp, *p = NULL;

            

            fp = strdup(from);

 

            if (!fp) {

                  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
"Memory Error!\n");

                  goto end;

            }

 

            if ((p = strchr(fp, '@'))) {

                  *p++ = '\0';

            }

 

            if (zstr(p)) {

                  p = profile->domain_name;

                  if (zstr(p)) {

                        p = host;

                  }

            }

 

            ffrom = switch_mprintf("\"%s\" <sip:%s+%s@%s>", fp, proto, fp,
p);

 

            from = ffrom;

            switch_safe_free(fp);

      }

//--------------------------------------------------------------------------
-----------------

 

 

 

> -----Original Message-----

> From: freeswitch-users-bounces at lists.freeswitch.org [mailto:freeswitch-

> 

> It's not a bug, you are being presumptuous.

> 

> Every chat interface has a proto prefix that helps FS to route the
messages to

> the right module.

> you sent it from mod_commands which chose the dp realm to advertise dp+

> 

> if you came in from SIP it is sip+ and conference are conf+ etc.....

> 

> 

> On Wed, Jan 19, 2011 at 1:43 PM, John Rose < <mailto:johnrose at comtex.net>
johnrose at comtex.net> wrote:

> >> -----Original Message-----

> >> From: John Rose [mailto:johnrose at comtex.net]

> >>

> >> Why does the chat API command prefix a "dp+" onto the From URI when I

> >> call the chat API?  Here is an argument that I am using:

> >>

> >>

> "sip|+15186819448 at 65.41.13.124|external/sip:+12062990047 at 65.41.13.125

> >> |

> >> Test message."

> >>

> >> Then the From header:

> >>

> >> From: \"+15186819448\"

> >> <sip:dp++15186819448 at 65.41.13.124>;tag=FUetK564c4egm\\r\\n

> >>

> >

> >

> > Argh, after looking through the code I think this is a FS bug where it

> > was intended for this "dp+" to be prefixed in the Jingle protocol

> > under certain circumstances not SIP.... looks very suspicious...

> >

> > John

> >

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20110119/dc8aa9f9/attachment-0001.html 


More information about the FreeSWITCH-users mailing list