POSSA / freepbx-SIP-URI-handling

3 stars 4 forks source link

General module information to moduleize script #1

Closed lgaetz closed 12 years ago

lgaetz commented 12 years ago

Idea is to implement the steps in this post: http://pbxinaflash.com/community/index.php?threads/sip-uri-dialing-piaf-purple.8717/page-2#post-56463

Need to edit /etc/asterisk/global_custom.conf in freePBX the path is $amp_conf[ASTETCDIR]."/global_custom.conf'

Need to set SIP Settings option srvlookup:

// print status of srvlookup
$sip_settings = sipsettings_get();
print $sip_settings['srvlookup'];    // will be yes or no

//change status of srvlookup to yes
$sip_settings['srvlookup'] = 'yes';
sipsettings_edit($sip_settings);

Need to edit /etc/asterisk/extensions_custom.conf , path is $amp_conf[ASTETCDIR].'/extension_custom.conf'

lgaetz commented 12 years ago

To get value to set global var:

$sip_settings = sipsettings_get(); $sip_settings[externip_val] //external IP set in SIP Settings

Also need to collect the public FQDN and LAN name (i.e. pbx.local) and LAN ip address

lgaetz commented 12 years ago

test for presence of custom contexts: $active_modules[customcontexts] will be an array of values if installed or undefined if not.

page.xxx.php will test for presence and display warning.

lgaetz commented 12 years ago

function to get list of system devices:

$list = core_devices_list() //returns 2d array of system devices $list[1]['id'] $list[2]['id'] //etc

method to check context of system devices:

$device = core_devices_get(101) $device[context] will equal the context define for ext 101

lgaetz commented 12 years ago

Proper way to set global Asterisk variables in FreePBX:

$sql ="REPLACE INTO globals (value,variable) VALUES ('test', 'TEST') ";
$check = $db->query($sql);
if (DB::IsError($check)) {
        die_freepbx( "Can not set global variable TEST" . $check->getMessage() .  "\n");
}