[asterisk-users] Issues with Local Channel

Mark Murawski markm-lists at intellasoft.net
Tue Nov 16 11:15:16 CST 2010


Local channels behave like an endpoint.  So instead of a sip phone 
picking up the call, asterisk is picking up the call.

Instead of someone speaking into a sip phone, asterisk can play tracks, 
or record digits, etc.

You need to make sure that the call does not end before you're done with 
your local channel.  Your current use is incorrect and your call is 
going to hang up before it does much of anything.

Channel: Local/1 at dtmf
Application: NoOp

This is guaranteed to not work... asterisk will spawn the local channel 
one one leg, lets call it the source leg, and it will run the 
application NoOp on the destination leg.  The NoOp will run, there is 
then no more dialplan to run, so the call will be hung up.

Also... using the G option to dial, is probably not what you want.  You 
must think of a local channel as an end point.

I'm not sure if this will get you exactly what you want, but it should 
get you further along the path.

# destination dialplan
[read]
exten => 1,1,Answer()
exten => 1,n,Read(data,play-msg,4,,2,15)
exten => 1,n,Verbose("${data}")
exten => 1,n,AGI(send_data.py,${data})
exten => 1,n,Hangup()

-- Note that timeout is in milliseconds

Action: Originate
Channel: DAHDI/1/99999999
Context: read
Exten: 1
Priority: 1
Timeout: 120000


This isn't using the local channel, but instead uses straight dialplan. 
  Asterisk will wait for the "source leg", 99999999 to answer, and once 
it does, it will execute [read]


Here's how to do it with local channels.

# source leg
[dialout]
exten => 1,1,Dial(dahdi/1/99999999,120)
exten => 1,n,Hangup()

# destination leg
[read]
exten => 1,1,Answer()
exten => 1,n,Read(data,play-msg,4,,2,15)
exten => 1,n,Verbose("${data}")
exten => 1,n,AGI(send_data.py,${data})
exten => 1,n,Hangup()

Action: Originate
Channel: Local/1 at dialout
Context: read
Exten: 1
Priority: 1
Timeout: 120000

Note, that the timeout applies to waiting for the Channel "source leg", 
endpoint to pick up.  If you put the timeout to say 1000, (1 second), 
asterisk will kill the call before the Dial() timeout of 120 seconds hit.



On 11/16/2010 07:57 AM, Sidarta Aguiar de Oliveira wrote:
> Hello,
>
> I don't really understand how channel Local works. I need that asterisk
> initiate a call and get some data (DTMF).
>
> So to do that I've created this dialplan :
>
> ; extensions.conf - the Asterisk dial plan
> ;
> [general]
> static=yes
> writeprotect=no
> clearglobalvars=no
>
> [dtmf]
> exten => 1,1,Verbose(Get User ID)
> exten => 1,n,Dial(dahdi/1/99999999,120,G(read^1^1))
> exten => 1,n,Hangup()
>
> [read]
> exten => 1,1,Hangup()
> exten => 1,n,Read(data,play-msg,4,,2,15)
> exten => 1,n,Verbose("${data}")
> exten => 1,n,AGI(send_data.py,${data})
> exten => 1,n,Hangup()
>
> File: test.call
>
> Channel: Local/1 at dtmf
> Application: NoOp
>
> I've create a file name test.call and then move the call file to the dir
> /var/spool/asterisk/outgoing/. Some issues I've had, the option G, in
> the Dial function don't wait the user answer the call to follow the
> dialplan. Is this rigth? Is this because I have used a Local Channel?
> Are better way to do that?
>
> Regards,
> *
> *
> *Sidarta Oliveira*
>




More information about the asterisk-users mailing list