Digit TransFormation?

107 views
Skip to first unread message

Temp Sync

unread,
Dec 12, 2020, 9:59:22 AM12/12/20
to dSIPRouter

Good Day,

Testing dsiprouter with a carrier and have run into a snag.

Carrier wants us to strip certain prefixes and prepend new ones before routing the calls to them, for example -

incoming digits (to dsiprouter) - 18685555555

remove the 1868 to leave the number - 5555555

then prepend 104 before sending to carrier - 1045555555

Haven't found a way to do this in the gui, is this possible at all?

Mack Hendricks

unread,
Dec 12, 2020, 10:15:06 PM12/12/20
to Temp Sync, dSIPRouter
Hi,

You can do this in Carrier Groups.  Click on the endpoint within the Carrier Group.  You can then specify the number of characters to strip and prefix.

image.png

--
You received this message because you are subscribed to the Google Groups "dSIPRouter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dSIPRouter+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dSIPRouter/093845bc-b36f-4f68-b40a-a4e37f98d3acn%40googlegroups.com.

Temp Sync

unread,
Dec 13, 2020, 8:46:03 AM12/13/20
to dSIPRouter
Thanks for the tip,

Setup a test rule and it seems to work in that the call is routed to the upstream SBC.

However the upstream SBC doesn't receive the transformed digits.

Do I need to do something extra to re-write the SIP header or something?

Mack Hendricks

unread,
Dec 13, 2020, 8:47:32 AM12/13/20
to Temp Sync, dSIPRouter
Did you do a Reload?  If you already did that then pease provide a SIP capture.

Temp Sync

unread,
Dec 13, 2020, 8:54:04 AM12/13/20
to dSIPRouter
Yes to reload, see capture below (also attached a pcap if that helps)

2020/12/12 16:47:45.280 1217 bytes
INVITE sip:10422...@186.96.221.62:5060 SIP/2.0 <---- rule was applied it seems!
Record-Route: <sip:186.96.221.116;lr;did=cbd.1d2>
Via: SIP/2.0/UDP 186.96.221.116;branch=z9hG4bKf822.99bde2a71a3481b7cc21f74d38b700a3.0
Via: SIP/2.0/UDP 192.168.1.158:5060;received=190.83.158.206;rport=5060;branch=z9hG4bKPja2c7f590-4449-4d0f-ba0e-eca1e4341ef8
From: <sip:609...@192.168.1.158>;tag=80cdde34-7b23-48a3-bba2-22d05c53c161
To: <sip:86822...@186.96.221.116>
Contact: <sip:aste...@192.168.1.158:5060>
Call-ID: 8fbd5d57-3d7c-4ed1-8b8a-ab4c25af5bc8
CSeq: 23781 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
Max-Forwards: 69
User-Agent: FPBX-14.0.13.26(13.18.3)
Content-Type: application/sdp
Content-Length: 356
P-hint: outbound

v=0
o=- 863899403 863899403 IN IP4 192.168.1.158
s=Asterisk
c=IN IP4 (null)
t=0 0
m=audio 12672 RTP/AVP 0 8 3 111 9 4 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:111 G726-32/8000
a=rtpmap:9 G722/8000
a=rtpmap:4 G723/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

2020/12/12 16:47:45.282 475 bytes
SIP/2.0 100 Trying
From:<sip:609...@192.168.1.158>;tag=80cdde34-7b23-48a3-bba2-22d05c53c161 
To:<sip:86822...@186.96.221.116> <----- This should be transformed, no?
Call-ID:8fbd5d57-3d7c-4ed1-8b8a-ab4c25af5bc8
CSeq:23781 INVITE
Server:TBSIP
Via:SIP/2.0/UDP 186.96.221.116;branch=z9hG4bKf822.99bde2a71a3481b7cc21f74d38b700a3.0;received=186.96.221.116;rport=5060
Via:SIP/2.0/UDP 192.168.1.158:5060;received=190.83.158.206;rport=5060;branch=z9hG4bKPja2c7f590-4449-4d0f-ba0e-eca1e4341ef8
Content-Length:0
201212-rggEdl49fCRO3YPIuk1zePYm.pcap

Frank Cristino

unread,
May 27, 2025, 1:27:57 PMMay 27
to dSIPRouter

Hello, I have the same issue. I’m receiving a “+” from a PBX, which I need to remove in order to send the number without the “+”. I tried setting “1” in the “strip” field in the list of carriers, but it didn’t work. I also tried entering the “+” directly, but that didn’t work either. Do you have any suggestions that could help me solve this problem?

 [140800050...@18.228.77.107:INVITE:<null>] No rules defined for sip:+55115...@18.228.77.107 going to sip:+55112...@104.155.146.177

for the outcalls i need remove the "+"  in list of carriers group , endpoints i try tu put 1 or + but the call dont connect


Mack Hendricks

unread,
May 27, 2025, 2:28:32 PMMay 27
to Frank Cristino, dSIPRouter
Hey Frank,

You can change this in the Carrier Detail section of a Carrier Group.

image.png


Frank Cristino

unread,
May 27, 2025, 2:40:32 PMMay 27
to dSIPRouter

I’ve tried that, but the result is the same — it doesn’t find a route to go out through my carrier. I’ve tried removing the number 1 and leaving only the + in Prefix, with Strip left blank, and the call still behaves the same.


May 27 18:39:12 gateway-aircall-production /usr/sbin/kamailio[150645]: WARNING: [/etc/kamailio/kamailio.cfg:1438:NEXTHOP] [140539144...@18.228.77.107:INVITE:<null>] No rules defined for sip:+551152831028@18.228.77strip0.png.107 going to sip:+55112...@104.155.146.177

endpoint.png

Mack Hendricks

unread,
May 27, 2025, 2:51:23 PMMay 27
to Frank Cristino, dSIPRouter
What does your outbound routes look like?

Frank Cristino

unread,
May 27, 2025, 2:53:47 PMMay 27
to dSIPRouter

I did it this way

out.png

Mack Hendricks

unread,
May 27, 2025, 3:12:02 PMMay 27
to Frank Cristino, dSIPRouter
Is your PBX setup as a carrier or endpoint group?  Based on the error message it look to be setup as a carrier group .  Make sure the ip’s are unique in the carrier group and endpoint group 

Frank Cristino

unread,
May 27, 2025, 3:20:14 PMMay 27
to dSIPRouter

The PBX is configured as an endpoint group. It’s the PBX that sends the “+”, it reaches dSIPRouter, and I need to remove the "+" sign in order to send the number without it to the carrier.

Mack Hendricks

unread,
May 27, 2025, 3:25:55 PMMay 27
to Frank Cristino, dSIPRouter

Voice1 Me

unread,
May 27, 2025, 3:39:27 PMMay 27
to Frank Cristino, dSIPRouter
Here is a real world example of how to configure that

PastedGraphic-1.png

In this example it is for a trunk to flowroute using IP authentication. They require tech prefix to pass calls this way.
Our clients are configured with a unique 5 digit code on all of their outbound calls 0001* 0002* etc.
We need to strip the 5 characters. So in the Strip field we just enter 5. 

Because our provider requires additional information (a prefix) to pass the calls we add the prefix they want for our account.

If you leave the Prefix  blank it will not add anything. If you put something in it it will add it to the Left most side of the number being sent.

If your PBX is sending dSIP router a +1 and the phone number and you wish to just remove the + symbol enter 1 in the Strip field.
If your provide does not require a prefix than leave the prefix blank!

You should also be aware that this affects all digits passing through this rule. 

So an e.164 number ( +18005551212 ) would be striped to 18005551212
But 8005551212 would ALSO be stripped to 005551212 which would likely fail to be delivered by your carrier.
Likewise 18005551212 would be stripped to 8005551212

If your carrier expects numbers in a specific format, you must assure you deliver it that way, which might require you to fine-tune how your PBX is sending digits to dSIP.
We for example only accept 1 + 10 digits from our endpoints. We reject everything else . This lets us simplify our management and rules. But you may need to provide support for 10 or 11 digit numbers being dialed and will need to adjust or create additional rule based on your business needs. Hope that helps.
- B.Davis


This email is unmonitored. Please call or open a support ticket online at support [at] voice1.me

Frank Cristino

unread,
May 27, 2025, 4:19:03 PMMay 27
to dSIPRouter

I tried as you indicated, and it’s still sending the “+”. I’m attaching an image showing how I configured it. I want to mention that I’ve tested by setting the value only in the carrier group and leaving it blank in the outbound route, also by setting it only in the outbound route and leaving the carrier group blank, and also with a combination of both. In all configurations, I get this in the log:


 WARNING: [/etc/kamailio/kamailio.cfg:1442:NEXTHOP] [140539912...@18.228.77.107:INVITE:<null>] No rules defined for sip:+55115...@18.228.77.107 going to sip:+55112...@104.155.146.177



config.png

Mack Hendricks

unread,
May 27, 2025, 4:42:07 PMMay 27
to Frank Cristino, dSIPRouter
Once we see a PCAP that will help us 


--
You received this message because you are subscribed to the Google Groups "dSIPRouter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dSIPRouter+...@googlegroups.com.

Frank Robespierre Cristino Escalona

unread,
May 27, 2025, 5:56:22 PMMay 27
to dSIPRouter
attach pcap:
capture.pcap

Mack Hendricks

unread,
May 27, 2025, 9:08:41 PMMay 27
to Frank Robespierre Cristino Escalona, dSIPRouter
Okay...so it definitely looks like an Outbound Route issue.  Can you re-create your Default Outbound Route and make sure you don't enter anything in the From and To Prefix.  The carrier group should just be defined.  Do a reload and then let's see what happens.  If that doesn't work...please run this command and provide the output

 mysql -e "select * from kamailio.dr_rules;"



Frank Robespierre Cristino Escalona

unread,
May 30, 2025, 1:38:20 PMMay 30
to dSIPRouter

I believe it’s a bug in the version I installed. Now on incoming calls I’m seeing “no route,” even though there is a route for the DID I’m using. I’ve attached evidence of all of the above; I hope you can shed some light.




```May 30 17:31:23 gateway-production /usr/sbin/kamailio[584619]: INFO: [/etc/kamailio/kamailio.cfg:2202:LOCATION] [02647ec86c3583bf...@34.27.200.57:5060:INVITE:<null>] In the location route.)
May 30 17:31:23 gateway-production /usr/sbin/kamailio[584619]: ERROR: [/etc/kamailio/kamailio.cfg:1112:ENRICH_DNID_LNP] [02647ec86c3583bf...@34.27.200.57:5060:INVITE:<null>] <core> [core/lvalue.c:351]: lval_pvar_assign(): non existing right pvar
May 30 17:31:23 gateway-production /usr/sbin/kamailio[584619]: ERROR: [/etc/kamailio/kamailio.cfg:1112:ENRICH_DNID_LNP] [02647ec86c3583bf...@34.27.200.57:5060:INVITE:<null>] <core> [core/lvalue.c:411]: lval_assign(): assignment failed at pos: (1112,15-1112,36)
May 30 17:31:23 gateway-production /usr/sbin/kamailio[584619]: INFO: [/etc/kamailio/kamailio.cfg:1228:NEXTHOP] [02647ec86c3583bf...@34.27.200.57:5060:INVITE:<null>] The call coming from 34.27.200.57 is from a carrier
May 30 17:31:23 gateway-production /usr/sbin/kamailio[584619]: ERROR: [/etc/kamailio/kamailio.cfg:2673:SET_CALLFWD_INFO] [02647ec86c3583bf...@34.27.200.57:5060:INVITE:<null>] <core> [core/lvalue.c:351]: lval_pvar_assign(): non existing right pvar
May 30 17:31:23 gateway-production /usr/sbin/kamailio[584619]: ERROR: [/etc/kamailio/kamailio.cfg:2673:SET_CALLFWD_INFO] [02647ec86c3583bf...@34.27.200.57:5060:INVITE:<null>] <core> [core/lvalue.c:411]: lval_assign(): assignment failed at pos: (2673,17-2673,38)
May 30 17:31:23 gateway-production /usr/sbin/kamailio[584619]: WARNING: [/etc/kamailio/kamailio.cfg:1264:NEXTHOP] [02647ec86c3583bf...@34.27.200.57:5060:INVITE:<null>] RURI routing failed, trying to route on the To header
May 30 17:31:23 gateway-production /usr/sbin/kamailio[584619]: WARNING: [/etc/kamailio/kamailio.cfg:1269:NEXTHOP] [02647ec86c3583bf...@34.27.200.57:5060:INVITE:<null>] No rules defined for <null> coming from this carrier endpoint: 34.27.200.57
```





inbound.png

Mack Hendricks

unread,
May 30, 2025, 1:51:49 PMMay 30
to Frank Robespierre Cristino Escalona, dSIPRouter
What does the INVITE look like?  and did you do a reload on Kamailio configuration.

V

unread,
Jun 17, 2025, 2:36:43 PMJun 17
to dSIPRouter
I noticed your outbound route is set to match only on numbers that start with +. Are you positive that your Gobravo_brasil trunk is the correct trunk you want to use? 
You might need to create a new carrier trunk to handle the stripping for just those rules.

I know there is a bug in the priority routing configuration confirmed with Tyler, so make sure you do not have Load Balancing enabled.  (the bug is that only the first rule is applied for stripping/prefixing and other rules do not get applied)
Make sure it is disabled. 
 SCR-20250617-kmcr.png
Reply all
Reply to author
Forward
0 new messages