PSTN to OpenSIPS to next SIP destination

不问归期 提交于 2021-02-10 16:44:10

问题


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.


回答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.



来源:https://stackoverflow.com/questions/57102581/pstn-to-opensips-to-next-sip-destination

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!