Dialing out thru truck, change domain to trunk dst ip

I have installed FreePBX on a RPi. I am using linphone or twinkle sip soft phones. I have extensions 6000 and 6001 for my domain. When I dial a external number just using the number the sip called party is [email protected] I have only one trunk going upstream and all external traffic goes there.
I the standard “wizard dial patterns” plus 0+ [NXXNXXXXXX] And send it to the trunk.

The problem is the outgoing sip number is [email protected] I would like to replace the domain with the IP of the upstream server so it would look like this [email protected] then it may route better.

Is there any documentation on replace domain with ip or cookie cutter template that I can follow?

I assume you mean SIP URI, rather than SIP number.

You should note that the SIP RFC says: “Using the fully-qualified domain name form is RECOMMENDED whenever possible”, so it actively discourages what you are trying to do. I also don’t understand why it is causing you routing problems; you might be able to better solve those by treating the destination as a loose routing proxy. What is your real problem?

Some providers may even insist on your using the fully qualified domain name.

Servers are quite likely to require SVR lookups, which cannot be done on IP addresses.

However, have you tried the obvious, which is to place the dotted quad address in the Server Name setting, for the trunk.

Also, I find your use of upstream confusing. I’d have to interpret it as what I would call downstream, i.e. towards the destination.

Thank you for answering. I am trying to make a sip phone look like a dial phone to asterisk, only receives a number that is the URI. To reduce DNS time in the switch, only IP addresses are used.
The sip client adds the domain name to the URI. I want to do replace the domain name with the output trunk IP address and add a prefix to the URI. The URI does the routing downstream, not the domain.

The domain name is part of the SIP URI. In fact it is the mandatory part of the URI. I don’t think your URI has the meaning of SIP URI.

Asterisk is likely to do a reverse DNS lookup, even if you give it an IP address.

Asterisk is a back to back user agent, so the incoming and outgoing host/domain fields are independent of each other.

It feels like you are over-engineering what is the standard usage of FreePBX, i.e. the user part of the request URI is treated as though it were a phone number.

I am a little confused, I am trying to interface asterisk to a telco switch, where the domain will be “dropped” and only the URI / telephone number is used for routing. Internal to the switch, the domain is changed to an IP of the next hop.
Right now I have only one trunk going to the telco switch, I see SIP keep alive packets on the trunk.

So let me rephrase my question, How do I route all external sip calls to the trunk?
Is there a suggested dial pattern for a PBX?

Here is my outbound route to the trunk

in future
There are five routine options
route to internal extension, 6XXX, 7XXX
route to local country number, trunk 0, 9NXXNXXXXXX, or what ever the local dial pattern is
route international trunk 1 90Z. (match country code)
route international trunk 2 90Z. (match other countries codes)
route to other sip switch, Where URI is alphanumeric

URIs are normally alphanumeric, and normally also contain “.” characters. I think you are using “URI” when you mean the, optional, userinfo part of the URI, and, in most cases, although not the alphanumeric one, the telephone-subscriber variant of userinfo.

SIP-URI          =  "sip:" [ userinfo ] hostport
                    uri-parameters [ headers ]
SIPS-URI         =  "sips:" [ userinfo ] hostport
                    uri-parameters [ headers ]
userinfo         =  ( user / telephone-subscriber ) [ ":" password ] "@"
user             =  1*( unreserved / escaped / user-unreserved )
user-unreserved  =  "&" / "=" / "+" / "$" / "," / ";" / "?" / "/"

The BNF for telephone-subscriber can be found in RFC 2806 [9]. Note, however, that any characters allowed there that are not allowed in the user part of the SIP URI MUST be escaped.

Although Asterisk itself, can cope with alphanumeric user fields, FreePBX is written on the assumption that it is dealing with telephone-subscribers, so, at best, it will be difficult to use them.

If you are trying to interpret the user as thought it were a domain (I’m still confused at what you are trying to do), that isn’t really within the scope of FreePBX, and it requires channel driver dependent coding in Asterisk.

Note, whilst I’m under the impression that there may be a legal requirement, in the USA, to allow 911 to be used from within a PABX system without any prefix digits, and therefore it may require special rules, the traditional way of handling PABX numbering is to require a 0 or a 9 (9 is common in the UK) prefix for external lines, which can considerably simplify the routing rules, and make it almost impossible for a local number to conflict with an external one.

NB. I am not up to speed on US 911 rules, or on FreePBX’s features to support them, so cannot guarantee that your current 911 handling is legal. I don’t think you have provided enough information to determine that.

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