Catching variable sent from PHP ARI originate

Hi ,
Can any one tell how to get the variables sent from channel originate function in StasisAppEventHandler() function , i have tried to print event variable but no luck

        public function StasisAppEventHandler()
        {
            $this->stasisEvents->on('StasisStart', function ($event) {
                $this->stasisLogger->notice("Event received: StasisStart");
                $this->stasisChannelID = $event->channel->id;
                //$this->stasisLogger->notice("CHANNL ID " . $this->stasisChannelID);
                print_r($event);              
                $this->phpariObject->channels()->channel_answer($this->stasisChannelID);
                $this->phpariObject->channels()->channel_playback($this->stasisChannelID, 'sound:demo-congrats', NULL, NULL, NULL, 'play1');
            });

originate function

$response = $channels->channel_originate(
    'PJSIP/'.'6001',
    NULL,
    array(
        "extension"      => "6001",
        "context"        => 'internal',
        "priority"       => 1,
        "app"            => "asterleaf",
        "appArgs"        => "",
        "callerId"       => "111",
        "timeout"        => -1,
        "channelId"      => $channel_id,
        "otherChannelId" => ""
    ),
    **array("var1" => "Value1")**
);
	

the variable var1 is not getting in StasisAppEventHandler

I havnt used such class, but here you can contact the developers https://github.com/greenfieldtech-nirs/phpari

Hi
Thanks, i found the solution , we have to enable the variables in ari.cionf

1 Like

I was almost asking you what was the option because I checked the ari.conf sample configuration file and didn’t find it, but as you said you found a solution I continue searching and found the option channelvars so I think it should be added to the ari.conf sample configuration file

https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+Configuration_res_ari