You can pass variables in the Originate Action, see http://www.voip-info.org/wiki/view/Asterisk+Manager+API+Action+Originate.

Taken from there:

*Variable*: Channels variables to set (max 32). Variables will be set for both channels (local and connected).


     Example(Placing a call from a SIP channel to an extension, this
     will cause the outside call not to be placed until the SIP channel
     has picked up):


Action: Originate
Channel: SIP/101test
Context: default
Exten: 8135551212
Priority: 1
Callerid: 3125551212
Timeout: 30000
*Variable: var1=23|var2=24|var3=25*
ActionID: ABC45678901234567890

That variables to send in the Originate action will become channel variables that can be retrieved on the context where the call goes. You can check that the variables exist on the context when the call is answered, for example:

[default]
exten => 8135551212,1,Noop(var1 is ${var1})
exten => 8135551212,n,Noop(var2 is ${var2})
exten => 8135551212,n,Noop(var3 is ${var3})
...

and so on... with no need to call Macro() or Gosub().

Cheers,

--
Ing. Miguel Molina
Grupo de Tecnología
Millenium Phone Center


Anahi Ludueña escribió:
Thanks,
I asked you to execute the GoSub from the Originate action, because I need to pass some parameters. First, I created a macro since I could pass the parameters from originate. But the macro's problem is it doesn't jump to the particular extension (for example: h extension). So, when you told me that GoSub could "replace" the Macro, I thought it could be called from the Originate... Do you know if there is another way to pass some parameters to a context from the Originate?
Thank you!


*
------------------------------------------------------------------------
*

*Anahi Ludueña*


------------------------------------------------------------------------
Date: Wed, 16 Sep 2009 10:27:26 -0500
From: mmol...@millenium.com.co
To: asterisk-users@lists.digium.com
Subject: Re: [asterisk-users] MeetMe in Macro

Hi,

The GoSub() application is intended for use in the dialplan, not to call it from a Originate Action. What is your specific need? You can Originate to a extension instead of an application an then if you need to execute a subroutine, you can use GoSub() and Return() then you need to on the called context.

You can check http://www.voip-info.org/wiki/index.php?page=Asterisk+cmd+Gosub but the example using the same context is not very clear.

A better example would be this:

[incoming]
exten => s,1,Answer()
exten => s,n,Noop(one)
exten => s,n,Noop(two)
exten => s,n,GoSub(mysub,s,1)
exten => s,n,Noop(I returned!)
exten => s,n,Hangup

[mysub]
exten => s,1,Noop(So I'm at a subroutine)
exten => s,n,Noop(I need to do special steps)
exten => s,n,Playback(tt-monkeys)
exten => s,n,Return()

Cheers,
--
Ing. Miguel Molina
Grupo de Tecnología
Millenium Phone Center
Anahi Ludueña escribió:

    Thanks Miguel, It was my mistake.
    So, my question is:
        if I want to call the GoSub application from the Originate
    Action (using AMI), what I need to put in the context parameter?
    The GoSub will jump to a special context.
    Thanks,



    ------------------------------------------------------------------------
    Date: Wed, 16 Sep 2009 09:34:31 -0500
    From: mmol...@millenium.com.co <mailto:mmol...@millenium.com.co>
    To: asterisk-...@lists.digium.com
    <mailto:asterisk-...@lists.digium.com>;
    asterisk-users@lists.digium.com
    <mailto:asterisk-users@lists.digium.com>
    Subject: Re: [asterisk-dev] MeetMe in Macro

    Hi,

    I didn't notice on my first answer, but we are on the -dev list
    and this is not related to asterisk code developing. I will answer
    you on the -users list, so we can continue the discussion there.

    Cheers,

-- Ing. Miguel Molina
    Grupo de Tecnología
    Millenium Phone Center
_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

AstriCon 2009 - October 13 - 15 Phoenix, Arizona
Register Now: http://www.astricon.net

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to