I use outbound_proxy=name.domain.com:port and the b2b_connect app.

When a new dialog is created (using the ruri constructed from the message forward from sip-router), I get an error message in the log telling me that req.next_hop port number could not be converted. Turns out req.next_hop is the outbound_proxy (don't know where it is set). The first "sip:" is stripped off and then name.domain.com:port is attempted converted using str2i().

The result is the same, outbound proxy is used, but I assume that next_hop can in some cases be different from outbound_proxy. The patch below replaces str2i() with parse_uri(). I don't know if that fix has side effects, but it removed my error :-)
g-)

--- SipCtrlInterface.cpp        (revision 1481)
+++ SipCtrlInterface.cpp        (working copy)
@@ -324,19 +324,18 @@

    if(!req.next_hop.empty()){
       string next_port;
-       const char* c = req.next_hop.c_str();
-       while(*c != 0){
-           if(*c == ':'){
-               next_port = string(c+1);
-               if(str2i(next_port,next_port_i)){
-                   ERROR("Could not convert port number in req.next_hop");
-                   ERROR("Using default outbound proxy");
-                   next_hop = SipCtrlInterfaceFactory::outbound_host;
-                   next_port_i = SipCtrlInterfaceFactory::outbound_port;
-               }
-               break;
+       sip_uri parsed_uri;
+       if (parse_uri(&parsed_uri, (char *)req.next_hop.c_str(),
+                     req.next_hop.length()) < 0) {
+           ERROR("invalid next hop\n");
+           ERROR("Using default outbound proxy");
+           next_hop = SipCtrlInterfaceFactory::outbound_host;
+           next_port_i = SipCtrlInterfaceFactory::outbound_port;
+       } else {
+           next_hop = c2stlstr(parsed_uri.host);
+           if (parsed_uri.port) {
+               next_port_i= parsed_uri.port;
           }
-           next_hop += *(c++);
       }
    }
    else if(!SipCtrlInterfaceFactory::outbound_host.empty()){
_______________________________________________
Sems mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/sems

Reply via email to