Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Gerry

Pages: [1]
1
Other Yate server issues / SIP outbound proxy patch
« on: July 11, 2020, 10:54:28 AM »
Hi,

Please find below a patch for Yate version 4.1.1. to get outbound proxying working. The patch introduces a new outboundproxy parameter which can be used for example from regexroute, like

; set proxy gateway
.*=;outboundproxy=112.203.17.24:5069

When this parameter is set it connects the outgoing YateSIPConnection to a proxy and sends all SIP messages there instead of the r-uri destination.

Comments re this patch would be highly welcome.

Cheers Gerry

@@ -4869,45 +4873,71 @@
     m_rtpForward = msg.getBoolValue(YSTRING("rtp_forward"));
     m_user = msg.getValue(YSTRING("user"));
     m_line = msg.getValue(YSTRING("line"));
+
     String tmp;
     YateSIPLine* line = 0;
     if (m_line) {
-   line = plugin.findLine(m_line);
-   if (line) {
-       if (uri.find('@') < 0 && !uri.startsWith("tel:")) {
-      if (!uri.startsWith("sip:"))
-          tmp = "sip:";
-      tmp << uri << "@" << line->domain();
-       }
-       m_externalAddr = line->getLocalAddr();
-   }
-    }
+       line = plugin.findLine(m_line);
+       if (line) {
+           if (uri.find('@') < 0 && !uri.startsWith("tel:")) {
+                if (!uri.startsWith("sip:"))
+                    tmp = "sip:";
+                tmp << uri << "@" << line->domain();
+           }
+           m_externalAddr = line->getLocalAddr();
+       }
+    }
+
     if (tmp.null()) {
-   if (!(uri.startsWith("tel:") || uri.startsWith("sip:"))) {
-       int sep = uri.find(':');
-       if ((sep < 0) || ((sep > 0) && (uri.substr(sep+1).toInteger(-1) > 0)))
-      tmp = "sip:";
-   }
-   tmp << uri;
+        if (!(uri.startsWith("tel:") || uri.startsWith("sip:"))) {
+            int sep = uri.find(':');
+            if ((sep < 0) || ((sep > 0) && (uri.substr(sep+1).toInteger(-1) > 0)))
+              tmp = "sip:";
+        }
+        tmp << uri;
     }
     m_uri = tmp;
     m_uri.parse();
-    if (!setParty(msg,false,"o",m_uri.getHost(),m_uri.getPort()) && line) {
-   SIPParty* party = line->party();
-   setParty(party);
-   TelEngine::destruct(party);
-    }
+
+    tmp.clear();
+    String rproxyaddr;
+    int rproxyport = 0;
+    tmp = msg.getValue(YSTRING("outboundproxy"));
+    if (tmp) {
+        int sep = tmp.find(':');
+        if (sep > 0) {
+            rproxyport = tmp.substr(sep + 1).toInteger(0);
+            rproxyaddr = tmp.substr(0,sep);
+        }
+        else
+            rproxyaddr = tmp;
+    }
+
+    if (rproxyaddr) {
+        setParty(msg,false,"o",rproxyaddr,rproxyport);
+    } else if (!setParty(msg,false,"o",m_uri.getHost(),m_uri.getPort()) && line) {
+       SIPParty* party = line->party();
+       setParty(party);
+       TelEngine::destruct(party);
+    }
+
     SIPMessage* m = new SIPMessage("INVITE",m_uri);
-    setSipParty(m,line,true,msg.getValue("host"),msg.getIntValue("port"));
+
+    if (rproxyaddr)
+        setSipParty(m,line,true,rproxyaddr,rproxyport);
+    else
+        setSipParty(m,line,true,msg.getValue("host"),msg.getIntValue("port"));
+
     if (!m->getParty()) {


2
Other Yate server issues / SIP outbound proxy not working
« on: July 09, 2020, 03:20:29 AM »
Hi,

How can I define a SIP outbound proxy for all calls routed by the register module?

I tried several things with no luck. The outbound parameter seems to be only used in ysipchan and I see some example uses
with regexroute and accfile but not with the register module.

I am able to set the outbound parameter in regexroute before routing hits the register module. The outbound parameter shows up in the message sniffer when doing routing with the register module. The INVITE is however sent to the R-URI address and not the outbound address. It seems that the outbound proxy functionality is not implemented for all SIP channels, just for LINE functions from accfile.

I am using yate 4.1.1

How can I fix this? If that is not implemented, where in the code should I patch that?

Thanks for you help.

Gerry

3
Yate based projects / Re: SIP drink provide / Small carrier for a NGO
« on: October 09, 2019, 10:15:09 AM »
Hi Markus,

The setup will be more elaborate if the PBXs want to talk with each other and you also have incoming calls or several trunks.

I can provide you a ready configured yate-based SBC / switch which can cover various routing scenarios. The switch can be installed locally (or in the cloud) and is managed online.

Are your users also calling to underdeveloped regions? If so the switch can pick automatically the routes that work. That saves a LOT of money because you can use also cheap international grey routes which sometimes work and sometimes not.

Please email me.

Gruss

Gerry

Pages: [1]