anyone get the transnexus scripts to work?

Status
Not open for further replies.

wa4zlw

Member
Jun 7, 2019
131
2
18
69
Blandon, PA
www.myinternetsupport.com
Hey all - happy sunday!

WE're trying to make the deadline next week and the documentation at Transnexus stir-shaken doc 4 freeswitch

we had the basic fail/pass working and now it's not we've stripped out everything and starting over and while it gets to clearip it never handles the next leg to call out to real gateway. also looking at their docs for the scripts/files to add seems inconsistent.

We have another call Monday 3pm Eastern, but if anyone has gone through this exercise, I'd be most appreciative in any pointers.

Thanks leon
 

junction1153

Member
Jul 15, 2020
52
11
8
33
I have it working

- In each of your outbound routes that you want Transnexus to throw the Identity header, add the following, order it at 30:
Action: set / clearipsti=1
Action: set / sip_h_Identity=${sip_i_identity}
Action: export / sip_h_Identity=${sip_i_identity}
- Bridge the call to the transnexus/clearIP trunk

- Create a new outbound route and make sure it is numbered before any other outbound route that is using TransNexus. Make it look like the attached. NOTE: SOME ITEMS ARE DISABLED! No need to input those into your system.

- Insert the below lua script to /usr/share/freeswitch/scripts and set permissions: chown www-data:www-data /usr/share/freeswitch/scripts/redirect.lua

- Finally, in the sip profile that your TransNexus trunk is attached to (most likely “internal”) make sure manual-redirect is set to ”true”. Flush cache and restart the profile

If you experience any issues at this point you may have to adjust a couple of parameters in the clearIP portal. For example, the SBC needs to be set a certain way, and then you need to create a domestic outbound route with the appropriate SBC selected.


Code:
--include config.lua
        require "resources.functions.config";

--add the function
        require "resources.functions.explode";
        require "resources.functions.trim";
        require "resources.functions.channel_utils";

--prepare the api object
        api = freeswitch.API();

-- The flag parameter identifying destination support STIR/SHAKEN
local shakenString = ";shaken"

-- The option to insert Identity header per destination
local branchString = "[sip_h_Identity=${identity}]"
--local branchString = "[sip_h_X-Identity=${identity}]"


-- If no Identity header in INVITE, use SIP 3xx X-Identity header
if not session:getVariable("identity") then
session:setVariable("identity", session:getVariable("sip_rh_X-Identity"))
end

-- Extract destination dial string from SIP 3xx
local inDialString = session:getVariable("sip_redirect_dialstring")

-- Insert Identity header into SIP INVITE to destinations supporting SHAKEN
local outDialString = ""
-- For each destination
for part in string.gmatch(inDialString , "([^|]+)") do
if string.match(part, shakenString) then
-- If destination supports SHAKEN, insert Identity header
outDialString = outDialString .. branchString .. string.gsub(part, shakenString, "") .. "|"
else
-- If destination does not support SHAKEN, do nothing
outDialString = outDialString .. part .. "|"
end
end

-- Erase trailing pipe char
session:setVariable("redirect_dialstring", string.sub(outDialString, 1, -2))
 

Attachments

  • 8CD1F530-F0D5-4F06-B983-98AECA9A7447.jpeg
    8CD1F530-F0D5-4F06-B983-98AECA9A7447.jpeg
    460.9 KB · Views: 27

wa4zlw

Member
Jun 7, 2019
131
2
18
69
Blandon, PA
www.myinternetsupport.com
hi @

junction1153

thanks for this...you mentioned inbound, right now we're just trying to get outbound working, then we'll deal with inbound any thoughts? ALso, looks like you threw away the transnexus document for the most part. We're going to look at this this morning

Thanks leon
 
Status
Not open for further replies.