public static function delete($trunk) { if ($interfaceId = arr::get($trunk, 'plugins', 'sipinterface', 'sipinterface_id')) { $xml = FreeSwitch::setSection('gateway', 'sipinterface_' . $interfaceId, 'trunk_' . $trunk['trunk_id']); $xml->deleteNode(); } }
public static function delete($base) { $xml = Telephony::getDriver()->xml; FreeSwitch::setSection('xmlcdr'); //not sure what to do here // $xml->deleteNode(); }
public static function delete($base) { if ($base instanceof Device) { $domain = '$${location_' . $base['User']['location_id'] . '}'; $xml = FreeSwitch::setSection('user', $domain, $base['device_id']); $xml->deleteNode('/variables/variable[@name="bypass_media"]'); } }
public static function set($base) { if ($base instanceof Device and $location_id = arr::get($base['User'], 'location_id')) { $domain = '$${location_' . $location_id . '}'; $xml = Telephony::getDriver()->xml; FreeSwitch::setSection('user', $domain, $base['device_id']); if ($areacode = arr::get($base, 'registry', 'areacode')) { $xml->update('/variables/variable[@name="areacode"]{@value="' . $areacode . '"}'); } else { $xml->deleteNode('/variables/variable[@name="areacode"]'); } } }
public static function set($base) { if ($base instanceof Device and $location_id = arr::get($base['User'], 'location_id')) { $domain = '$${location_' . $location_id . '}'; $xml = Telephony::getDriver()->xml; FreeSwitch::setSection('user', $domain, $base['device_id']); if (($outbound_intercept_group = arr::get($base, 'plugins', 'callintercept', 'outbound_intercept_group')) != NULL) { $outbound_intercept_group = implode('|', preg_split('/[,\\s\\/\\\\|\\.]/', $outbound_intercept_group, NULL, PREG_SPLIT_NO_EMPTY)); $xml->update('/variables/variable[@name="interceptgroup"]{@value="' . $outbound_intercept_group . '"}'); } else { $xml->deleteNode('/variables/variable[@name="interceptgroup"]'); } } }
public static function delete($base) { if ($base instanceof Voicemail) { $xml = FreeSwitch::setSection('user', 'voicemail_' . $base['account_id'], $base['voicemail_id']); $xml->deleteNode(); } else { if ($base instanceof Device) { $voicemail = $base['plugins']['voicemail']; $domain = '$${location_' . $base['User']['location_id'] . '}'; $xml = FreeSwitch::setSection('user', $domain, $base['device_id']); $xml->deleteNode('/variables/variable[@name="mwi-account"]'); $xml->deleteNode('/params/param[@name="mwi-account"]'); } } }
public static function delete($base) { // Reference to our XML document $xml = Telephony::getDriver()->xml; if ($base instanceof Conference) { FreeSwitch::section('conference_profile', $base['conference_id']); $xml->deleteNode('/param[@name="caller-id-number"]'); } elseif ($base instanceof Device) { $domain = '$${location_' . $base['User']['location_id'] . '}'; FreeSwitch::setSection('user', $domain, $base['device_id']); $xml->deleteNode('/variables/variable[@name="outbound_caller_id_name"]'); $xml->deleteNode('/variables/variable[@name="outbound_caller_id_number"]'); $xml->deleteNode('/variables/variable[@name="internal_caller_id_name"]'); $xml->deleteNode('/variables/variable[@name="internal_caller_id_number"]'); } }
public static function delete($base) { $xml = Telephony::getDriver()->xml; if ($base instanceof Device) { if (empty($base['plugins']['timezone'])) { return; } $timezone = $base['plugins']['timezone']; $domain = '$${location_' . $base['User']['location_id'] . '}'; $xml = FreeSwitch::setSection('user', $domain, $base['device_id']); $xml->deleteNode('/variables/variable[@name="timezone"]'); } else { if ($base instanceof Voicemail) { if (empty($base['plugins']['timezone'])) { return; } $timezone = $base['plugins']['timezone']; $xml = FreeSwitch::setSection('user', 'voicemail_' . $base['account_id'], $base['voicemail_id']); $xml->deleteNode('/variables/variable[@name="timezone"]'); } } }
public static function set($base) { if ($base instanceof SipInterface) { $xml = FreeSwitch::setSection('sofia', 'sipinterface_' . $base['sipinterface_id']); $xml->update('/settings/param[@name="tls"]{@value="' . (isset($base['plugins']['sipencryption']['enable']) && $base['plugins']['sipencryption']['enable'] == 'TRUE' ? 'TRUE' : 'FALSE') . '"}'); if ($base['plugins']['sipencryption']['type'] == 'tlsv1') { $xml->update('/settings/param[@name="tls-bind-params"]{@value="transport=tls"}'); } else { $xml->update('/settings/param[@name="tls-bind-params"]{@value=""}'); } if (isset($base['plugins']['sipencryption']['port'])) { $xml->update('/settings/param[@name="tls-sip-port"]{@value="' . $base['plugins']['sipencryption']['port'] . '"}'); } else { $xml->update('/settings/param[@name="tls-sip-port"]{@value="' . ($base['port'] + 1) . '"}'); } if (isset($base['plugins']['sipencryption']['certdir'])) { $xml->update('/settings/param[@name="tls-cert-dir"]{@value="' . str_replace('/', '\\/', $base['plugins']['sipencryption']['certdir']) . '"}'); } else { $xml->update('/settings/param[@name="tls-cert-dir"]{@value="$${base_dir}\\/conf\\/ssl"}'); } $xml->update('/settings/param[@name="tls-version"]{@value="' . $base['plugins']['sipencryption']['type'] . '"}'); } }
public static function delete($base) { if ($base instanceof Odbc) { $xml = FreeSwitch::setSection('odbc'); $xml->deleteNode('/X-PRE-PROCESS[@cmd="set"][@bluebox="odbc_' . $base['odbc_id'] . '"]'); if (class_exists('SipInterface')) { $interfaces = Doctrine::getTable('SipInterface')->findAll(); foreach ($interfaces as $interface) { if (empty($interface['plugins']['odbc']['odbc_id'])) { continue; } if ($interface['plugins']['odbc']['odbc_id'] != $base['odbc_id']) { continue; } $plugins = $interface['plugins']; unset($plugins['odbc']); $interface['plugins'] = $plugins; $interface->save(); $xml = FreeSwitch::setSection('sofia', 'sipinterface_' . $interface['sipinterface_id']); $xml->deleteNode('/settings/param[@name="odbc-dsn"]'); } } } }
public static function delete($autoattendant) { FreeSwitch::setSection('autoattendant', $autoattendant['auto_attendant_id'])->deleteNode(); }
public static function delete($netList) { // Reference to our XML document & context $xml = FreeSwitch::setSection('netlist', $netList['net_list_id']); $xml->deleteNode(); }
public static function update_aliases($location_id, $alias_sipinterface_id = NULL) { $location_name = '$${location_' . $location_id . '}'; $sipinterfaces = Doctrine::getTable('SipInterface')->findAll(); foreach ($sipinterfaces as $sipinterface) { $sipinterface_id = $sipinterface['sipinterface_id']; $xml = FreeSwitch::setSection('sofia_aliases', 'sipinterface_' . $sipinterface_id); if ($sipinterface_id == $alias_sipinterface_id) { $xml->update('/alias[@name="' . $location_name . '"]'); } else { $xml->deleteNode('/alias[@name="' . $location_name . '"]'); } } }
public static function set($base) { if ($base instanceof Device) { if (isset($base['plugins']['simpleroute']['tags'])) { $tags = preg_split('/[\\s\\,]+/', $base['plugins']['simpleroute']['tags']); sort($tags); $tags = implode(" ", $tags); } else { $tags = ""; } $domain = '$${location_' . $base['User']['location_id'] . '}'; $xml = FreeSwitch::setSection('user', $domain, $base['device_id']); $xml->update('/variables/variable[@name="bluebox-tags"]{@value="' . $tags . '"}'); } elseif ($base instanceof Simpleroute) { foreach (Doctrine::getTable('Context')->findAll() as $thiscontext) { $routenumber = 0; if (array_key_exists("simpleroute", $thiscontext->plugins)) { foreach ($thiscontext->plugins["simpleroute"] as $route) { $trunk = Doctrine::getTable('Trunk')->find($route["trunk"]); $destination = Doctrine::getTable('SimpleRoute')->find($route["destination"]); $pattern_number = 0; foreach (simplerouter::getOutboundPattern($route["destination"], 'freeswitch') as $pattern) { $routenumber++; $pattern_number++; $xml = FreeSwitch::createExtension("route_{$routenumber}", 'main', 'context_' . $thiscontext->context_id); if (!isset($route["taglist"])) { $route["taglist"] = ""; } # Remove all the children, and put in a comment so we can see where we are! $xml->replaceWithXML('<!-- CONTEXT: ' . $thiscontext->context_id . ' - ' . $thiscontext->name . '; DESTINATION: ' . $route["destination"] . ' - ' . $destination->name . '; TRUNK: ' . $route["trunk"] . ' - ' . $trunk->name . '; PATTERN: ' . $pattern_number . ' - ' . $pattern . " TAGS: {$route['taglist']} -->"); if ($route["taglist"] != "") { $taglist = preg_split('/[\\s\\,]+/', $route["taglist"]); sort($taglist); $taglist = '^(.* |)' . implode('( .* | )', $taglist) . '( .*|)$'; $xml->update('/condition[@field="${bluebox-tags}"][@break="on-false"][@expression="' . $taglist . '"]'); } $xml->update('/condition[@field="destination_number"][@break="on-false"][@expression="' . $pattern . '"][@bluebox="extension-in"]'); // If a Caller ID module is installed and caller ID is set, use it // TODO: Integrate this into the plugin $caller_id = '/condition[@field="${outbound_caller_id_number}"][@expression="^.+$"][@break="never"][@bluebox="caller_id"]'; $xml->update($caller_id . '/action[@application="set"][@data="effective_caller_id_name=${outbound_caller_id_name}"]'); $xml->update($caller_id . '/action[@application="set"][@data="effective_caller_id_number=${outbound_caller_id_number}"]'); // Put Caller ID into the right place if (isset($sip['caller_id_field'])) { if ($sip['caller_id_field'] == 'rpid' or $sip['caller_id_field'] == 'pid') { $xml->update($caller_id . '/action[@application="export"][@bluebox="caller_id_field"]{@data="sip_cid_type=' . $sip['caller_id_field'] . '"}'); } else { // Assume Caller ID is default or elsewhere $xml->deleteNode($caller_id . '/action[@application="export"][@bluebox="caller_id_field"]'); } } $dummy = '/condition[@field="destination_number"][@break="never"][@expression="' . $pattern . '"]'; if (!empty($route['continue_on_fail'])) { $xml->update($dummy . '/action[@application="set"][@bluebox="setting_continue_on_fail"]{@data="failure_causes=NORMAL_CLEARING,ORIGINATOR_CANCEL,CRASH"}'); } else { $xml->deleteNode($dummy . '/action[@application="set"][@bluebox="setting_continue_on_fail"]'); } $xml->update($dummy . '/action[@application="bridge"][@bluebox="extension_out"]{@data="sofia\\/gateway\\/trunk_' . $route['trunk'] . '\\/' . $route["dialstring"] . '"}'); } } } // If there are any routes > routenumber, then they are old and need to be deleted. $routenumber++; $xml = FreeSwitch::createExtension("route_{$routenumber}", 'main', 'context_' . $thiscontext->context_id, array("existing")); while ($xml !== FALSE) { $xml->deleteNode(); $routenumber++; $xml = FreeSwitch::createExtension("route_{$routenumber}", 'main', 'context_' . $thiscontext->context_id, array("existing")); } } } }
public static function delete($conference) { $xml = FreeSwitch::setSection('conference_profile', $conference['conference_id']); $xml->deleteNode(); }
public static function delete($sipinterface) { if (!$sipinterface instanceof SipInterface) { return TRUE; } // Reference to our XML document $xml = Telephony::getDriver()->xml; // The section we are working with is <document><section name="configuration"><configuration name="conference.conf"> FreeSwitch::setSection('sofia', 'sipinterface_' . $sipinterface['sipinterface_id']); $xml->deleteNode(); }
public static function delete($base) { $xml = FreeSwitch::setSection('location'); $xml->deleteNode('/X-PRE-PROCSS[@cmd="set"][@bluebox="location_' . $base['location_id'] . '"]'); }
public static function set($dbnData) { if ($dbnData instanceof Dbndir) { $xml = Telephony::getDriver()->xml; $root = '//document/section[@name="configuration"]/configuration[@name="directory.conf"][@description="Directory"]'; $xml->setXmlRoot($root); $updatestr = '/settings'; $xml->update($updatestr); $root = '//document/section[@name="configuration"]/configuration[@name="directory.conf"][@description="Directory"]/profiles/profile[@name="dbnprofile_' . $dbnData->dbn_id . '"]'; $xml->setXmlRoot($root); if (isset($dbnData->dbn_max_menu_attempts) && !empty($dbnData->dbn_max_menu_attempts) && $dbnData->dbn_max_menu_attempts != '') { $updatestr = '/param[@name="max-menu-attempts"]{@value="' . $dbnData->dbn_max_menu_attempts . '"}'; } else { $updatestr = '/param[@name="max-menu-attempts"]{@value="3"}'; } Kohana::log('debug', $updatestr); $xml->update($updatestr); if (isset($dbnData->dbn_min_search_digits) && !empty($dbnData->dbn_min_search_digits) && $dbnData->dbn_min_search_digits != '') { $updatestr = '/param[@name="min-search-digits"]{@value="' . $dbnData->dbn_min_search_digits . '"}'; } else { $updatestr = '/param[@name="min-search-digits"]{@value="3"}'; } $xml->update($updatestr); if (isset($dbnData->dbn_terminator_key) && !empty($dbnData->dbn_terminator_key) && $dbnData->dbn_terminator_key != '') { $updatestr = '/param[@name="terminator-key"]{@value="' . $dbnData->dbn_terminator_key . '"}'; } else { $updatestr = '/param[@name="terminator-key"]{@value="#"}'; } $xml->update($updatestr); if (isset($dbnData->dbn_digit_timeout) && !empty($dbnData->dbn_digit_timeout) && $dbnData->dbn_digit_timeout != '') { $updatestr = '/param[@name="digit-timeout"]{@value="' . $dbnData->dbn_digit_timeout . '"}'; } else { $updatestr = '/param[@name="digit-timeout"]{@value="3000"}'; } $xml->update($updatestr); if (isset($dbnData->dbn_max_result) && !empty($dbnData->dbn_max_result) && $dbnData->dbn_max_result != '') { $updatestr = '/param[@name="max-result"]{@value="' . $dbnData->dbn_max_result . '"}'; } else { $updatestr = '/param[@name="max-result"]{@value="5"}'; } $xml->update($updatestr); if (isset($dbnData->dbn_next_key) && !empty($dbnData->dbn_next_key) && $dbnData->dbn_next_key != '') { $updatestr = '/param[@name="next-key"]{@value="' . $dbnData->dbn_next_key . '"}'; } else { $updatestr = '/param[@name="next-key"]{@value="6"}'; } $xml->update($updatestr); if (isset($dbnData->dbn_prev_key) && !empty($dbnData->dbn_prev_key) && $dbnData->dbn_prev_key != '') { $updatestr = '/param[@name="prev-key"]{@value="' . $dbnData->dbn_prev_key . '"}'; } else { $updatestr = '/param[@name="prev-key"]{@value="4"}'; } $xml->update($updatestr); if (isset($dbnData->dbn_switch_order_key) && !empty($dbnData->dbn_switch_order_key) && $dbnData->dbn_switch_order_key != '') { $updatestr = '/param[@name="switch-order-key"]{@value="' . $dbnData->dbn_switch_order_key . '"}'; } else { $updatestr = '/param[@name="switch-order-key"]{@value="*"}'; } $xml->update($updatestr); if (isset($dbnData->dbn_select_name_key) && !empty($dbnData->dbn_select_name_key) && $dbnData->dbn_select_name_key != '') { $updatestr = '/param[@name="select-name-key"]{@value="' . $dbnData->dbn_select_name_key . '"}'; } else { $updatestr = '/param[@name="select-name-key"]{@value="1"}'; } $xml->update($updatestr); if (isset($dbnData->dbn_new_search_key) && !empty($dbnData->dbn_new_search_key) && $dbnData->dbn_new_search_key != '') { $updatestr = '/param[@name="new-search-key"]{@value="' . $dbnData->dbn_new_search_key . '"}'; } else { $updatestr = '/param[@name="new-search-key"]{@value="3"}'; } $xml->update($updatestr); if (isset($dbnData->dbn_search_order) && !empty($dbnData->dbn_search_order) && $dbnData->dbn_search_order != '') { $updatestr = '/param[@name="search-order"]{@value="' . $dbnData->dbn_search_order . '"}'; } else { $updatestr = '/param[@name="search-order"]{@value="last_name"}'; } $xml->update($updatestr); } else { if ($dbnData instanceof Device) { $dbndir = $dbnData['plugins']['dbndir']; $domain = '$${location_' . $dbnData['User']['location_id'] . '}'; $xml = FreeSwitch::setSection('user', $domain, $dbnData['device_id']); if (isset($dbndir['full_name']) && !empty($dbndir['full_name']) && $dbndir['full_name'] != '') { $xml->update('/variables/variable[@name="directory_full_name"]{@value="' . $dbndir['full_name'] . '"}'); } else { $username = $dbnData->User->first_name . ' ' . $dbnData->User->last_name; $xml->update('/variables/variable[@name="directory_full_name"]{@value="' . $username . '"}'); } if (isset($dbndir['visible']) && !empty($dbndir['visible']) && $dbndir['visible'] != '') { $xml->update('/params/param[@name="directory-visible"]{@value="True"}'); } else { $xml->update('/params/param[@name="directory-visible"]{@value="False"}'); } if (isset($dbndir['announce_ext']) && !empty($dbndir['announce_ext']) && $dbndir['announce_ext'] != '') { $xml->update('/params/param[@name="directory-exten-visible"]{@value="True"}'); } else { $xml->update('/params/param[@name="directory-exten-visible"]{@value="False"}'); } } } }
public static function delete($base) { if ($base instanceof Device) { $domain = '$${location_' . $base['User']['location_id'] . '}'; $xml = FreeSwitch::setSection('user', $domain, $base['device_id']); $xml->deleteNode(); } else { if ($base instanceof Trunk) { $plugins = $base['plugins']; if (!empty($plugins['sipinterface']['sipinterface_id'])) { $xml = FreeSwitch::setSection('gateway', 'sipinterface_' . $plugins['sipinterface']['sipinterface_id'], 'trunk_' . $base['trunk_id']); $xml->deleteNode(); } } } }
public static function delete($base) { $xml = Telephony::getDriver()->xml; FreeSwitch::setSection('cdr_csv'); $xml->deleteNode('/settings/template[@name="account_' . $base->account_id . '"]'); }