PASS PARAMETER TO AGI FROM DIALPLAN

Any and all non-support discussions

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

PASS PARAMETER TO AGI FROM DIALPLAN

Postby mohitnichaal » Thu Feb 07, 2019 12:46 am

Hi,

I am using Vicidial VERSION: 2.9-441a and Asterisk 1.8.23.0.

I would like to pass PARAMETER from dialplan(extensions.conf) to vicidial agi like as below :

extensions.conf :
[trunkinbound]
; DID call routing process
; exten => _XXXXXXXXXX,1,AGI(agi-DID_route.agi) ; use this one instead of the one below if you are having delay issues, and match to number of received digits
exten => _X.,1,AGI(registed_number.php,${EXTEN})
same => n,NoOp(${rmcount})
exten => _X.,n,AGI(agi-DID_route.agi,${rmcount})

rmcount value coming from registed_number.php and also showing in NoOP , but unable to get in agi file.

-- <SIP/1.1.1.1-0000002a>AGI Script registed_number.php completed, returning 0
-- Executing [4758101@trunkinbound:2] NoOp("SIP/192.168.6.92-0000002a", "NRMN") in new stack
-- Executing [4758101@trunkinbound:3] AGI("SIP/192.168.6.92-0000002a", "agi-DID_route.agi,NRMN") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/agi-DID_route.agi
-- <SIP/1.1.1.1-0000002a>AGI Script agi-DID_route.agi completed, returning 0

I want to receive argument value in agi :

use Asterisk::AGI;
$AGI = new Asterisk::AGI;
$CLI_stat = $ARGV_vars[0];
print "SET CALLERID $CLI_stat\n";
mohitnichaal
 
Posts: 2
Joined: Wed Feb 06, 2019 8:09 am

Re: PASS PARAMETER TO AGI FROM DIALPLAN

Postby Noah » Thu Feb 07, 2019 3:34 pm

The agi will need to expect the parameter being passed.

Here's an example from
/var/lib/asterisk/agi/agi-VDAD_ALL_inbound.agi

When you pass variables to AGI this is an example string (your dialplan example)
exten => 1234,2,AGI(agi-VDAD_ALL_inbound.agi,CID-----LB-----INB-----7274515134-----Closer-----park----------999-----1-----OUTB)
You could pass $EXTEN for example

exten => 1234,2,AGI(agi-VDAD_ALL_inbound.agi,${EXTEN}-----LB-----INB-----7274515134-----Closer-----park----------999-----1-----OUTB)


The parameters variables are set to $ARGV[0]
The parser is looking at this variable $ARGV[0] to pull out all the variables you want to pass

### begin parsing run-time options ###
if (length($ARGV[0])>1)

Below the original variable set $ARGV[0], the parser splits out the parameters you want to pass, and assigns them to variable names.
So for example the first variable set below $call_handle_method is assigned to the first position in the array $ARGV_vars[0];
Pass the variables you want separated by ----- and then make the adjustments in the parser.

### list of command-line array arguments:
@ARGV_vars = split(/-----/, $ARGV[0]);

$call_handle_method = $ARGV_vars[0];
$agent_search_method = $ARGV_vars[1];
$channel_group = $ARGV_vars[2];
$inbound_number = $ARGV_vars[3];
$parked_by = $ARGV_vars[4];
$park_extension = $ARGV_vars[5];
$status = $ARGV_vars[6];
$list_id = $ARGV_vars[7];
$phone_code = $ARGV_vars[8];
$Scampaign_id = $ARGV_vars[9];
$agent_only = $ARGV_vars[10];
$vendor_id = $ARGV_vars[11];
$vid_enter_filename = $ARGV_vars[12];
$vid_id_number_filename = $ARGV_vars[13];
$vid_confirm_filename = $ARGV_vars[14];
$vid_validate_digits = $ARGV_vars[15];
}

Recommend copying the AGI you want to test with and altering setting the name in the dialplan and testing before altering any in production AGI scripts.
MyCallCloud.com - Cool Vici Customizations - Hosted - Configured - Supported
Web: https://mycallcloud.com
P: 888-663-0760
E: sales@mycallcloud.com
Noah
 
Posts: 90
Joined: Tue Feb 08, 2011 7:14 pm

Re: PASS PARAMETER TO AGI FROM DIALPLAN

Postby williamconley » Thu Feb 07, 2019 3:58 pm

mohitnichaal wrote:Hi,

I am using Vicidial VERSION: 2.9-441a and Asterisk 1.8.23.0.

I would like to pass PARAMETER from dialplan(extensions.conf) to vicidial agi like as below :

extensions.conf :
[trunkinbound]
; DID call routing process
; exten => _XXXXXXXXXX,1,AGI(agi-DID_route.agi) ; use this one instead of the one below if you are having delay issues, and match to number of received digits
exten => _X.,1,AGI(registed_number.php,${EXTEN})
same => n,NoOp(${rmcount})
exten => _X.,n,AGI(agi-DID_route.agi,${rmcount})

rmcount value coming from registed_number.php and also showing in NoOP , but unable to get in agi file.

-- <SIP/1.1.1.1-0000002a>AGI Script registed_number.php completed, returning 0
-- Executing [4758101@trunkinbound:2] NoOp("SIP/192.168.6.92-0000002a", "NRMN") in new stack
-- Executing [4758101@trunkinbound:3] AGI("SIP/192.168.6.92-0000002a", "agi-DID_route.agi,NRMN") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/agi-DID_route.agi
-- <SIP/1.1.1.1-0000002a>AGI Script agi-DID_route.agi completed, returning 0

I want to receive argument value in agi :

use Asterisk::AGI;
$AGI = new Asterisk::AGI;
$CLI_stat = $ARGV_vars[0];
print "SET CALLERID $CLI_stat\n";


1) It is required to include the full vicidial version with BUILD in your post. You left off the build. It doesn't hurt to also include your installer (method and version).

2) AGI scripts get their variables from the asterisk channel. Thus assinging the value to a channel variable will allow you to later grab that channel variable IF the channel is not altered by another Vicidial script.

Code: Select all
exten => 100,1,Set(GLOBAL(FOO)=456)


3) Vicidial AGI scripts are written in perl. I don't know how you got the value for ${rmcount} from registed_number.php, but whatever method you used could have been done directly in the Vicidial AGI script instead OR the Vicidial AGI script could have requested the value from registed_number.php.

4) Otherwise, of course, Noah is correct in that the AGI script must be expecting the value to be passed

5) Mostly, however, I strongly suspect you are trying to perform a task that is already available in Vicidial somewhere and are spending a great deal of time doing it "your way". What does this value represent, and what are you trying to do with it? guessing: But have a look at Filter URL DID Redirect (available when you "modify DID" in the Inbound menu)
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20018
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: PASS PARAMETER TO AGI FROM DIALPLAN

Postby mohitnichaal » Fri Feb 08, 2019 12:04 am

Hi William

Yes you are right i am trying to REDIRECT DID as follows :
DID call came to vicidial --->lookup the ANI in our CRM -> IF ANI registered in CRM then follow DID route with REGISTERED CALL MENU ----> otherwise follows NON REGISTERED CALL MENU.

I hope you will understand my requirement.If this feature is already available in Vicidial GUI then please guide for the same.

Mohit Nichaal
mohitnichaal
 
Posts: 2
Joined: Wed Feb 06, 2019 8:09 am

Re: PASS PARAMETER TO AGI FROM DIALPLAN

Postby williamconley » Fri Feb 08, 2019 10:54 am

have a look at Filter URL DID Redirect (available when you "modify DID" in the Inbound menu)


This can be used to hit a URL (the Fitler URL) and redirect the caller to a different DID, which can be specified by the Filter URL, which can then be routed to another route (like your call menu). This feature is already in Vicidial. No need for custom code or ANY modification to the original extensions.conf file.
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20018
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 66 guests