Use defined line / VOIP trunk for outbound call (new call / recalls / missed call)


I am running different VOIP trunks (hotline services) on the PBX. So I’ve got an inbound rule per trunk as well as one outbound rule per trunk.

  1. Is there any possibilty to choose the outbound rule / VOIP trunk individually per call? So for example I want to do a call with s special VOIP trunk (phonenumber). Is this possible?
  2. In case of a call coming in on VOIP trunk 3 (for example) and I will recall this from the history it should be possible to use the same VOIP trunk 3 - is it possible?
  3. Last case: I have a missed call in the the history - how can I make sure to use the same VOIP trunk the missed call was addressed to?

Another idea: In the UCM there is some feature to directly connect the caller to the extension he has been connected the last time.
So the feature I am looking for would (for #2 and #3) would be a config checkbox like “Use same VOIP trunk of last call”. So either for an inbound call from the history the known VOIP trunk would be used as well as (if #1 is possible) the last chosen line would be used automatically.

I know all of those features from the Fritzfon and I hope that at least 2 and 3 are possible.


I’ve setup outbound routes with 99 and 98. If I dial 99 plus the number, it goes through one trunk. If I dial 98 plus the number, it goes through the other trunk.


Make sure to define the trunk
Strip 2.

Let me know if that’s not clear, I can send a screen shot or something.


NM, here’s a screenshot anyway. In this example, I’m using 50 as the numbers to select the trunk.

I’ve also decided to control what number of #'s can be in an outbound number (weird sentence bonus points).


@costwisewpg This is a great idea and setup as long as GS does not implement a direct feature to choose the outbound line for calls.

I’ve just had an idea related to #2 and #3: Would it be possible to have this setting:
Incoming call on line 5 (for example) will prepend a 99 to the phonenumber. So in the history this 99 will be shown. When recalling this number the 99 will be the trigger to use the outbound rule of line 5 as from your setup and strip the 99 again for calling the correct number.

Would this be a possible?

Update: I’ve changed the inbound line to this:

So calls come in with prepending “MyTrunkname-”.
Next I’ve changed the outbound rule to this

But for now it says that no matching calling plan is found.


Ok - I just checked with a 55 instead of “MyTrunkname-” and it works here. So calls come in with the prepending 55 (of course phonebook recognization is not possible if you did not add this here as well). And the outbound rule is correctly choosing the correct line.
Now it would be great to have the prepending name of the trunk instead of a number - so this problem would be partly (for not known numbers) solved as well.


It is working this way, i use this for customers.
Adding PREFIX before number, then redial use correct outband route become of this.
For phone book add this number with prefix as work number or other.

Alternative is multiple account on phone
1 line XXX
2 line YYY
Then you can select by Caller ID for correct calling.


Thanks - but does this Prefix need to be a number or can it be a word also?


it can be letters, but you can’t dial normally then.
Also You must allow this in dialplan (or do not check it for history)


I was thinking that the strip-feature will delete the digits before the dial plan is contacted otherwise the 55 would have lead to an incorrect number. Am I wrong?


Dial plan in PHONE not ucm :slight_smile:


I am using the prepend number solution at the moment because there does not seem to be another possibility yet (feature request!).

I am prepending a simple two digit number for each inbound line like 22 followed by the number. To make it look better on the display I first added a - behind this so like 22- followed by the number. This works but because there is no - on the phone to be dialed there is no possibility to say “I want to call a new number using line 22”. So I thought about using the * for it like 22* followed by the number. This can be entered using the phone keys. But unfortunately I did not find a matching dial plan to match 22*[NUMBER].
Is this possible?


I’ve suddenly got a problem with the rule to prepend and strip two digits. When trying to call a number like 170170[whatever] - the “phone” says “Der Anruf wurde abgelehnt” (“The call was rejected”). I do not know why.

P.S. It does not matter whether I write _17x. or _17X.


You see this try in CDr or not ?

Also check if ext have National privilege to call.


I am not totally sure what the problem was but now it works. I realized though I added / prepended “17-” to the number I only needed to strip 2 digits. It seems the UCM strips the - automatically.
Do you have an idea about the * problem from post 10?




Thanks! Works great.

For all interested, this is the “complete” documentation for having this issue done:

  1. Define unique numbers per line you want to have. I use two digit numbers.
  2. Edit / add inbound route for each line. Using this setting as an example:
    (The pattern depends on the SIP provider. For 1und1 I use _X. for Fonial I need to use _. - do not know why)
    The Caller-ID number field says the following: Every number that calls in will get a prepending 170 AND the first three digits (in my case +49) will be striped. So an example would be +49111222333 will be converted to be shown a 170111222333
    Furtheron the namefield will prepend the name of the trunk which is not shown anymore (see ).
  3. Add / edit an outbound rule per line:
    The pattern says that it is possible to have either 170111222333 OR 17+49111222333. It is important to strip the first three digits (17*) in order to have the correct number.
  4. For me hard to understand because we strip the three first digits but we need to add a new pattern to the dial plan of the phone(s) as well. In this case it would be xx*x+ for this. I use Zero Config and have this dial plan for Germany: { x+ | x+ |+x+ | xxx+ | **x+ | xxx+ }

With this setting it is possible to:

  1. see on which line the call comes in (the Caller Name from the inbound line)
  2. call a number from the history using the same line the call was done last time
  3. Choose the correct line manually by adding the digits for example 17* before the number

Anyhow - I hope Grandstream will add a real feature to choose the line and use the same line for the outbound call as for the inbound call but for now I am happy with this.


Oh damn, one last issue just came up. I’ve got a SIP provider (Sipload) connected to the UCM. The numbers / VOIP trunks of this provider do not accept the prepending numbers, asterisk and name. It just shows the number in format +49111222333
I’ve already tried a lot but no change.
Inbound rule is “standard”

Voip trunk as well

I am able to use the matching outbound rule with the prepending 23* so this works here. Only the inbound rule does not affect the incoming call information on the phone. I’ve checked the CDR and found this

Anyone an idea?


It can be pattern.
Read incoming packet and see what they sent you on TO and request id.


I will check - another thing: I just connected our analog fax with the FXS1 port and it worked great - out of the box. BUT is there ANY chance to create a rule for this FXS port to use a special outbound rule (dedicated fax phone number)? In this case it is not possible to prepend anything manually.
Any idea?


I just tried to “read incoming packet” - I used the pcap for this but it did not help me. Can you give me a hint how to find out the problem / read the packet?