Quantcast
Channel: General Help - FreePBX Community Forums
Viewing all articles
Browse latest Browse all 12635

AGI Variable DEXTEN not being passed to custom module

$
0
0

@FreeSWServers wrote:

Problem: I can't seem to get the agent name via the variable DEXTEN in my custom module.

I have a custom module which gets the agent name via the following:

(which works on an FreePBX 12/Ast 11/Distro 6 install), but not on SNG7/FreePBX 14 install w/ configs copied using the conversion tool.

(Bare with me, I'm not 100% familiar with all this)

functions.php

/* 	Generates dialplan
	We call this with retrieve_conf
*/
function bsurvey_get_config($engine) {
	dbug("I am here @ get config");
	global $ext;  // is this the best way to pass this?
	global $conferences_conf;
	global $core_conf;
	switch($engine) {
		case "asterisk":
			$surveylist = bsurvey_list(true);
			dbug("I am here @ get config");
			$DYN='';
			if(is_array($surveylist)) {
				foreach($surveylist as $item) {
					$thisitem = bsurvey_get(ltrim($item['id']));
					// add dialplan
					//$ext->add('bsurvey', $item['id'], '', new ext_wait(10));
					$ext->add('bsurvey', $item['id'], '', new ext_set('bsurvey_name',$item['displayname']));
					$ext->add('bsurvey', $item['id'], '', new ext_set('bsurvey_start','${CDR(start)}'));
					$ext->add('bsurvey', $item['id'], '', new ext_set('bsurvey_unqiueid','${CDR(uniqueid)}'));
					$ext->add('bsurvey', $item['id'], '', new ext_set('bsurvey_agent','${DEXTEN}'));
					$ext->add('bsurvey', $item['id'], '', new ext_set('bsurvey_aname_key=/AMPUSER/${DEXTEN}/cidname'));
					$ext->add('bsurvey', $item['id'], '', new ext_set('bsurvey_aname','${DB(${bsurvey_aname_key})}'));
//					$ext->add('bsurvey', $item['id'], '', new extension('Dumpchan'));
					$ext->add('bsurvey', $item['id'], '', new extension('AGI(bsurvey.php)'));

bsurvey.php

$AGI->exec('Set','bsurvey_agent_name=${DB(/AMPUSER/'.$bsurvey_agent.'/cidname)}');
$r=$AGI->database_get('AMPUSER/'.$bsurvey_agent,'cidname');
adebug("This is the bsurvey_agent= $bsurvey_agent");

[root@voip2 agi]# cat /etc/asterisk/extensions* | grep bsur

DYNAMIC_FEATURES = bsurvey1#apprecord
[bsurvey]
include => bsurvey-custom
exten => 1,1,Set(bsurvey_name=support)
exten => 1,n,Set(bsurvey_start=${CDR(start)})
exten => 1,n,Set(bsurvey_unqiueid=${CDR(uniqueid)})
exten => 1,n,Set(bsurvey_agent=${DEXTEN})
exten => 1,n,Set(bsurvey_aname_key=/AMPUSER/${DEXTEN}/cidname=)
exten => 1,n,Set(bsurvey_aname=${DB(${bsurvey_aname_key})})
exten => 1,n,AGI(bsurvey.php)
;--== end of [bsurvey] ==--;
[macro-bsurvey]
include => macro-bsurvey-custom
exten => s,n,ChannelRedirect(${BRIDGEPEER},bsurvey,${ARG1},1)
;--== end of [macro-bsurvey] ==--;
[root@voip2 agi]#

Posts: 43

Participants: 5

Read full topic


Viewing all articles
Browse latest Browse all 12635

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>