1

I have worked with Asterisk for years but I am very new to OpenSIPS. What I need is to have calls come in from our DID provider to the OpenSIPS server then redirect them to another SIP URI.

Something like this:

DID Origination Provider -> OpenSIPS -> next SIP server

Basically I need the OpenSIPS server to sit between my DID provider and and Plivo which is basically a Twilio type service.

I have installed OpenSIPS and the control panel GUI. Using the GUI I have successfully setup calls to go from the DID provider to any of the the SIP phones I have registered to OpenSIPS, calls work fine.

I need to spend a lot of time learning the routing logic and such for OpenSIPS which I am willing to do but, at the moment I am trying to solve the problem and hoping there is a solution using the OpenSIPS CP. If not, I am hoping for an example on how to set this up in the config files.

Any help is appreciated, I have been at this for several days and have searched Google and Youtube, looked over tutorials, watched videos, spent time reading the book etc. So, not for lack of effort. This will obviously be quite a learning curve but, I am hoping for a little help to get this specific task done sooner than later.

Thanks again, in advance for any help. Using the latest 2.4 version of OpenSIPS on Debian 8 if that matters.

Fonewiz
  • 2,065
  • 3
  • 17
  • 17
  • I should also mention that I am basically trying to take any call that comes in from any of my DID provider's IP addresses and fwd it to the next destination via sip URI. The only modification I need to make is to change the way the number is sent to me (NPANXXXXXX) to (+1NPANXXXXXX). – Fonewiz Jul 18 '19 at 21:05

1 Answers1

1

First of all: there is no way of doing this via CP. The OpenSIPS CP is meant to work on a lower level, helping you manage your data (users, routing rules, routing destinations, dialplan rules, TLS certs, etc.). Any custom, higher-level logic linking these pieces of data together needs to be scripted within opensips.cfg.

Fortunately, the default opensips.cfg already covers 90% of what we need here. So, instead of routing calls to users and going straight through to Plivo, you should remove this part:

# do lookup with method filtering
if (!lookup("location","m")) {
    ...
}

... and then either:

  1. preserve the Request-URI, but make the message route out to Plivo when doing t_relay():
$du = "sip:your_plivo_ip:5060"; # set a "destination URI"
  1. rewrite the Request-URI of the SIP message, so it will head out to Plivo upon doing t_relay():
$ru = "sip:your_plivo_ip:5060"; # rewrite the "Request-URI"

And that's it! The default script already does record_route(), ensuring the proxy stays within the path of all mid-call requests.

Liviu Chircu
  • 1,000
  • 3
  • 11
  • 24
  • Thank you for the info, I will give this a try today and let you know how it goes. Seriously, it's been hard to get answers from anywhere in regards to OpenSIPS. Doesn't seem folks a too generous with their info in IRC or anywhere else that I have found. – Fonewiz Jul 22 '19 at 17:20
  • 1
    I currently don't have if (lookup("location")) {} in my opensips.cfg I do have something similar though # do lookup with method filtering if (!lookup("location","m")) { t_newtran(); t_reply("404", "Not Found"); exit; } Still looking – Fonewiz Jul 22 '19 at 17:51
  • That is exactly the block I was suggesting. I've edited the answer to be more precise :) – Liviu Chircu Jul 23 '19 at 08:10