How to Forward call to external number?

Get help with installing, upgrading and running Asterisk.

Moderators: muppetmaster, Moderator, Support

How to Forward call to external number?

Postby aristech » Fri Nov 21, 2014 9:21 pm

I wanted to know how I can give users the option to forward number to an external number for example home or cell phone?
aristech
Oldsterisk
 
Posts: 52
Joined: Fri Nov 21, 2014 5:59 pm

Re: How to Forward call to external number?

Postby ambiorixg12 » Fri Nov 21, 2014 9:40 pm

The must basic could be :
exten=>_x.,1,Dial(SIP/${mytrunk}/${yourcellpone},25)
ambiorixg12
Astmaster
 
Posts: 967
Joined: Sun Mar 04, 2007 9:32 pm
Location: Dominican Republic

Re: How to Forward call to external number?

Postby david55 » Sat Nov 22, 2014 4:01 am

You need some persistent storage, e.g. astdb.

Then you define an extension number in the context used by your local user that stores the new destination against the original extension number (either supplied as part of the destination request or recovered from caller ID, etc.).

Finally, you add a test in the dialplan for claling the original extension that tests if the persistent data is set, and uses it, either directly to dial the call, or as a Goto target for the new destination. Be careful with the latter, as error recovery will be in a context with privileges to dial that number.
david55
Moves Like Spencer
 
Posts: 12570
Joined: Fri Sep 26, 2008 5:03 am

Re: How to Forward call to external number?

Postby aristech » Mon Nov 24, 2014 11:12 am

ambiorixg12 wrote:The must basic could be :
exten=>_x.,1,Dial(SIP/${mytrunk}/${yourcellpone},25)



So by adding this line to my extensions.conf should be fine?

Code: Select all
exten => 1017,1,Dial(SIP/117,20)
exten => 1017,n,Dial(DAHDI/g4/${4165551212},25)
exten => 1017,n,Goto(default,s,4,3)
exten => 1017,n,VoiceMail(117@VoiceMail)
exten => 1017,n,VoiceMail()


This is what the third line means
Code: Select all
exten => s,4,Background(2)
aristech
Oldsterisk
 
Posts: 52
Joined: Fri Nov 21, 2014 5:59 pm

Re: How to Forward call to external number?

Postby johnkiniston » Mon Nov 24, 2014 11:27 am

aristech wrote:
ambiorixg12 wrote:The must basic could be :

So by adding this line to my extensions.conf should be fine?

Code: Select all
exten => 1017,1,Dial(SIP/117,20)
exten => 1017,n,Dial(DAHDI/g4/${4165551212},25)
exten => 1017,n,Goto(default,s,4,3)
exten => 1017,n,VoiceMail(117@VoiceMail)
exten => 1017,n,VoiceMail()


This is what the third line means
Code: Select all
exten => s,4,Background(2)


The third line in your [code] block is a Goto not a Background and it's malformed at that. You have too many options to your Goto.

Also your second Dial statement is invalid unless you have a variable named 4165551212 storing the number to call.

Try
[code]
exten => 1017,1,Dial(SIP/117,20)
exten => 1017,n,Dial(DAHDI/g4/4165551212,25)
exten => 1017,n,Playback(vm-leavemsg)
exten => 1017,n,VoiceMail(117@VoiceMail)
exten => 1017,n,Hangup()
johnkiniston
Oldsterisk
 
Posts: 53
Joined: Thu Nov 15, 2012 6:50 pm
Location: Tucson, AZ

Re: How to Forward call to external number?

Postby aristech » Mon Nov 24, 2014 11:29 am

johnkiniston wrote:
aristech wrote:
ambiorixg12 wrote:The must basic could be :

So by adding this line to my extensions.conf should be fine?

Code: Select all
exten => 1017,1,Dial(SIP/117,20)
exten => 1017,n,Dial(DAHDI/g4/${4165551212},25)
exten => 1017,n,Goto(default,s,4,3)
exten => 1017,n,VoiceMail(117@VoiceMail)
exten => 1017,n,VoiceMail()


This is what the third line means
Code: Select all
exten => s,4,Background(2)


The third line in your [code] block is a Goto not a Background and it's malformed at that. You have too many options to your Goto.

Also your second Dial statement is invalid unless you have a variable named 4165551212 storing the number to call.

Try
[code]
exten => 1017,1,Dial(SIP/117,20)
exten => 1017,n,Dial(DAHDI/g4/4165551212,25)
exten => 1017,n,Playback(vm-leavemsg)
exten => 1017,n,VoiceMail(117@VoiceMail)
exten => 1017,n,Hangup()



Thanks I am going to try it and let you know.
I will not be able to try until after hours. Would this be the same as the Followme Feature? Or does this ring both phones simultaneously? Or does it ring the extension then the External number and if no one picks up either it defaults back to the asterisk voice mail?
aristech
Oldsterisk
 
Posts: 52
Joined: Fri Nov 21, 2014 5:59 pm

Re: How to Forward call to external number?

Postby johnkiniston » Mon Nov 24, 2014 4:34 pm

aristech wrote:Thanks I am going to try it and let you know.
I will not be able to try until after hours. Would this be the same as the Followme Feature? Or does this ring both phones simultaneously? Or does it ring the extension then the External number and if no one picks up either it defaults back to the asterisk voice mail?


This is not Followme. Nor does it ring both phones simultaneously. It dials the SIP device and then dials out your DAHDI hardware and if neither location answers it goes into Voicemail.

If you wanted to ring both phones at the same time you would just dial both at the same time like this:

1017,1,Dial(SIP/117&DAHDI/G4/4165551212,25)
johnkiniston
Oldsterisk
 
Posts: 53
Joined: Thu Nov 15, 2012 6:50 pm
Location: Tucson, AZ

Re: How to Forward call to external number?

Postby aristech » Mon Nov 24, 2014 6:49 pm

OK Thanks Here is what happens when I place a call to this number from the outside with
Code: Select all
exten => 1017,1,Dial(SIP/117,20)
exten => 1017,n,Dial(DAHDI/g4/4155551212,25)
exten => 1017,n,Playback(vm-leavemsg)
exten => 1017,n,VoiceMail(117@VoiceMail)
exten => 1017,n,Hangup()


I get the below message

Code: Select all
Called SIP/117
    -- SIP/117-00000011 is ringing
    -- Nobody picked up in 20000 ms
    -- Executing [1017@Incoming:2] Dial("DAHDI/i1/6505554980-26", "DAHDI/g4/4155551212,25") in new stack
    -- Called DAHDI/g4/4155551212
    -- DAHDI/29-1 answered DAHDI/i1/6505554980-26
    -- Native bridging DAHDI/i1/6505554980-26 and DAHDI/29-1
    -- Span 1: Channel 0/1 got hangup request, cause 16
    -- Hanging up on 'DAHDI/29-1'
    -- Hungup 'DAHDI/29-1'
  == Spawn extension (Incoming, 4017, 2) exited non-zero on 'DAHDI/i1/6505554980-26'
    -- Hungup 'DAHDI/i1/6505554980-26'
aristech
Oldsterisk
 
Posts: 52
Joined: Fri Nov 21, 2014 5:59 pm

Re: How to Forward call to external number?

Postby david55 » Tue Nov 25, 2014 2:03 am

Looks successful to me.
david55
Moves Like Spencer
 
Posts: 12570
Joined: Fri Sep 26, 2008 5:03 am

Re: How to Forward call to external number?

Postby aristech » Tue Nov 25, 2014 11:04 am

Yes was successful I was just missing a 1 infront of the number to dial outside once I put that in all was working thanks for the help. Big load off my shoulders.
aristech
Oldsterisk
 
Posts: 52
Joined: Fri Nov 21, 2014 5:59 pm


Return to Asterisk Support

Who is online

Users browsing this forum: No registered users and 14 guests