2

Am trying to create an inbound calling application where in a caller calls Asterisk , the caller channel identifies an extension to dial from an DB , then Asterisk originates a call to that extension and which inturn creates a conference and the caller is looped into the conference. Am using the Originate application and the ConfBridge. The challenge I am facing is: 1)the variable identified in the caller channel is not inherited to the calle(extension) channel ,inspite of using the __ prefix to my variable. 2)I then decided to use the Asterisk DB. By using the ${UNIQUEID} as the key to store my values and thereby retrieve the variables in different channels. This proved futile since - upon using the Originate application for my second channel , the UNIQUEID also varies.

Below is a simplied version of my application(Approach1):

    [local]
exten = main,1,Answer()
exten = main,n,Set(__operator=201005)
exten = main,n,GoSub(operator,logintoconf,1)
exten = main,n,GoSub(caller,logintoconf,1)


[caller]
exten = logintoconf,1,ConfBridge(${operator},escalationbridge,caller)
exten = logintoconf,n,Return()

[operator]
exten = logintoconf,1,Originate(SIP/201005,exten,handler-callee,callee,1)
exten = logintoconf,n,NoOp("Call complete" ${DIALSTATUS} )
exten = logintoconf,n,Return()


[handler-callee]
exten = callee,1,Set(CHANNEL(hangup_handler_push)=hangup-callee,s,1)
exten = callee,n,NoOp(handler-callee................)
exten = callee,n,ConfBridge(${operator},escalationbridge,operator)

[hangup-caller]
exten = s,1,NoOp("Hangup caller" ${CHANNEL} )
exten = s,n,Hangup
exten = s,n,Return()

[hangup-callee]
exten = s,1,NoOp("Calleee Hangup " ${CHANNEL} )
exten = s,n,Hangup
exten = s,n,Return()

in the above the __operator , does n't inherit the values to the operator channel.

Appreciate any inputs that can help me share the variables using the Dialplan.

Thanks.

Vineeth
  • 41
  • 5

1 Answers1

0

You can inherit only in inherited channels. Since you are originating new channels, they can't inherit.

You can send to second,third etc channel global variable name or use SHARED function.

arheops
  • 15,544
  • 1
  • 21
  • 27
  • Thanks.Shared function sounds to solve the problem, however i am not sure if it could pose any possible variable mixing when there are concurrent calls.Say incoming call1 and call2 happen at the same time. Call1 gets a shared variable "op" assigned to channel1 and i end up using this for channel2 as well. But since there are concurrent calls , is there a chance of the the "op" set for call1/channel1 being used for call2/channel2. – Vineeth Dec 05 '15 at 23:12
  • Apparently Shared didn't work. I tried replace the initial set with exten = main,n,Set(SHARED(operator)=201005) and retrieve it using ${SHARED(operator)} in the channel after the originate action. This doesn't work since the Shared value is retrieved against the current channel and I don't have a way of carrying the channel1 details right across to channel2 - so that i can end up using SHARED(operator,channel1) for both setting and getting!...is this some sort of a limitation with DIalplan...do i need to venture onto using AGI! – Vineeth Dec 06 '15 at 00:49
  • You can spot channel name of first channel and send it to second via variable, You just need program accordinly. http://www.voip-info.org/wiki/view/Asterisk+Manager+API+Action+Originate (see example) – arheops Dec 06 '15 at 01:09
  • The link talks about using AMI actions. But the dialplan application for Originate doesn't have a place holder to fit in a variable . Is there a way i can set the Originate variable using dialplan? – Vineeth Dec 06 '15 at 02:21
  • Yes, you can send channel name as EXTEN. – arheops Dec 06 '15 at 09:12
  • Am sorry , I am not able to follow you. Are you referring to : SHARED(operator,channel1) or the Originate app. Appreciate if you could give an example. – Vineeth Dec 06 '15 at 12:10
  • originate to destination=first channel. after that get other variables,including destination number form channel1 using SHARED function. – arheops Dec 06 '15 at 18:28
  • Well am not sure if we are in the same page. Once I use the originate app to call my operator the exten specified in it moves on to the new channel and all the information stored in channel 1 is not accessible...thats why i am not able to use the operator name as the ID to call using the ConfBridge. To use SHARED function the channel ID needs to be passed...and once Channel2 is created - it doesn't have a way to retrieve the channel 1's ID. Hence the problem. I tried to use Asterisk DB as well...but the Unique identifier( $UNIQUEID) can't be relied upon as it too changes with channel. – Vineeth Dec 06 '15 at 23:03
  • Sorry, i have nothing to add. You should read more about asterisk after that re-read messages above. Yes, i am sure i did such task before. – arheops Dec 06 '15 at 23:05