Outbound route - digits to remove problem

I’m running FreePBX 17 and have a strange issue with outbound route.

I’ve created a outbound route which I put right at the top below emergency and in the dial pattern for the route I added a 3 digits in the prefix column followed by X. in the match pattern. Then in Additional Settings, the section that says digits to remove I chose 3 And when I press submit to save it. The entire route saves except the digits to remove reverts straight back to 0 and as a result it’s just not stripping any of the prefix digits that I need removed.

I tried removing the route and tried it on other routes and still same problem.

Can anyone please advise? what’s happening and how do I solve this?

Thanks

This isn’t documented in the online version of the user guide (which is, admittedly out of date). Just including the digits in prefix should be enough to get them stripped; I can’t seem them changing things to require and extra option in the simple case. I’m guessing the option you’ve found doesn’t do what you think it does.

There does seem to be such an option in Switchvox, but that is a closed source front to Asterisk, and had no peer support forum.

Digits to remove / store relate to the allowlist module only. These settings do not affect what gets sent on the trunk.

If your route is not working, check the Asterisk log to see whether it is being chosen. For example, if the CallerID field is not blank, it may not be matching your situation.

The route itself is work but I am trying to strip 3 digits that I have in the prefix column.

So, am I correct in understanding that anything in the prefix column will automatically get stripped out anyway and I don’t need to specify it to be stripped out?

If that’s the case, is it normal in the CDR for it to be showing the destination of the call with the prefix? based on the CDR i’m assuming it’s trying to call the number with the prefix still in place.

It’s best to look at the Asterisk full log to see what is actually happening.

1 Like

Hi @johnr
Just add the dial prefix. Once the pattern matches, the digits will be removed before being sent to the trunk.
Also, check the Asterisk CLI logs to ensure the trunk is matched correctly and the dialed numbers are accurate.

image

1 Like

Sorry this might be a silly question, but how do i check what number was actually being passed and if the prefix is being stripped in the Asterisk full log? because in CDR report the destination shows with the prefix still on it.

It should be right in the log file when it hits the outbound routes.

You look for the Dial application call in the log.

I can’t remember exactly how FreePBX does it, but the destination in the CDR is the Asterisk extension that was being run at the time. I think FreePBX takes the actual number to call from a variable. In the case of a successful call, that may appear in the CDR (not sure about FreePBX, though), but it will be in the Data field, embedded in the parameters to Dial(). The log will show the exact parameters to Dial.

If the call is failing, it might be that the wrong number format is used, but might be other things, like an unacceptable, or wrong format caller ID has been used, in which case you may need to “pjsip set logger on”, or the corresponding legacy command, to include the actual SIP exchange in the log. I’m assuming SIP as you have not said otherwise, and that is right in most cases when the protocol is not specified.

Thank you all for the replies. So from the full logs i’ve confirmed that the prefix is actually being stripped before it is sent to the trunk which is good.

Does anyone know how I can store the correct number without the prefix in the CDR destination column? I’d like the actual number that’s being dialled to be displayed in the CDR destination column without the prefix.

To be clear, the prefix isn’t stripped the digits are manipulated. So if you have a 3 digit prefix when it hits the outbound route and Dial()'s out the trunk it sets the dial string as (Dial/${EXTEN:3}@outbound-trunk) which means strip the first 3 digits away.

The dst field in the CDR will always be the presented digits by default. You could update this by doing Set(CDR(dst)=${EXTEN:3}) which should just set the field to what you want but this will require you to do custom work to make this happen. That custom work would have to be after it hits the outbound route outbound route context since that is where your Local channel dials into. So you would need to do a custom outbound route.

CDR(dst) is read only, see CDR - Asterisk Documentation

1 Like

Yeah, slipped my mind. So no, it can’t be changed.

Thanks to everyone for the helpful responses! Everything is working as expected now. You were right about the dst being read-only, so I’ve placed the dialed number in a user field instead, which works perfectly for my needs.

I have a follow-up question regarding the prefix: will FreePBX/Asterisk accept a comma in the prefix field, or is it considered an invalid character? I know that phones can use a comma in speed dials to introduce a pause, and I was thinking of using a comma in the prefix since it doesn’t affect the final stage of the call. If this works, it would make the Destination value in the CDR report much easier to read, with the comma separating the prefix from the main number.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.