[ASTPPCOM-36] Contribute new code for DID call type management Created: 09/Aug/16 Updated: 27/Oct/19 Resolved: 05/Sep/17 |
|
| Status: | Done |
| Project: | ASTPP Community |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | v3.5 |
| Type: | New Feature | ||
| Reporter: | fozzygo4 | Assignee: | Samir Doshi |
| Resolution: | Done | Votes: | 0 |
| Labels: | contribution | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
Hi Team. I have modified and added my own code for DID management. I felt the need for ability to add call types of direct IP calling and a simpler version of the "OTHER" call type. I labeled them as Direct-IP and DID@IP/URL. See screenshot. Let me know how and if you would like me to share the code. The functions are as follows: Examples: DID@IP/URL: DID field = 1235551234 and Destination field = 1234@1.2.3.4
|
| Comments |
| Comment by Samir Doshi [ 09/Aug/16 ] |
|
@FozzyGo4, Yeah it will be good if you contribute code. This will be helpful for people who usually doing call routing to IP only. |
| Comment by fozzygo4 [ 09/Aug/16 ] |
|
Awesome so should I just post it here? |
| Comment by Samir Doshi [ 11/Aug/16 ] |
|
Either you can send us the contribution in github as pull request https://guides.github.com/activities/contributing-to-open-source/ |
| Comment by fozzygo4 [ 11/Aug/16 ] |
|
Ok im not sure how to do a pull request as I have never done so before so I will submit code here. Firstly in webUI /astpp/application/libraries/astpp/common.php Edit the code as follows: function set_call_type($call_type = "") {
$call_type_array = array("-1" => "--Select--",'1' => 'DID-Local','3'=>'SIP-DID','4'=>'Direct-IP','5'=>'DID@IP/URL', '0' => 'PSTN', '2' => 'Other',);
return $call_type_array;
}
function set_call_type_search(){
$call_type_array = array("" => "--Select--",'1' => 'DID-Local','3'=>'SIP-DID','4'=>'Direct-IP','5'=>'DID@IP/URL', '0' => 'PSTN', '2' => 'Other',);
return $call_type_array;
}
function get_call_type($select = "", $table = "", $call_type) {
$call_type_array = array('1' => 'DID-Local','3'=>'SIP-DID','4'=>'Direct-IP','5'=>'DID@IP/URL','0' => 'PSTN', '2' => 'Other','-1'=>"");
return $call_type_array[$call_type];
}
function get_custom_call_type($call_type) {
$call_type_array = array('DID-Local' => '1','SIP-DID'=>'3','Direct-IP'=>'4','DID@IP/URL'=>'5','PSTN' => '0','Other' => '2',""=>"-1");
return $call_type_array[$call_type];
}
This gives extra options for the dropdown menu. Then in /usr/local/freeswitch/scripts/astpp/scripts/astpp.xml.lua add the following under: elseif(tonumber(didinfo['call_type']) == 2 and didinfo['extensions'] ~= '') then table.insert(xml, [[<action application="set" data="calltype=OTHER"/>]]); table.insert(xml, [[<action application="bridge" data="]]..didinfo['extensions']..[["/>]]); elseif(tonumber(didinfo['call_type']) == 4 and didinfo['extensions'] ~= '') then table.insert(xml, [[<action application="set" data="calltype=DIRECT-IP"/>]]); table.insert(xml, [[<action application="bridge" data="sofia/default/]]..destination_number..[[@]]..didinfo['extensions']..[["/>]]); elseif(tonumber(didinfo['call_type']) == 5 and didinfo['extensions'] ~= '') then table.insert(xml, [[<action application="set" data="calltype=DID@IP"/>]]); table.insert(xml, [[<action application="bridge" data="sofia/default/]]..didinfo['extensions']..[["/>]]); |
| Comment by Samir Doshi [ 05/Sep/17 ] |
|
Released in ASTPP v3.5. |
| Comment by fozzygo4 [ 05/Sep/17 ] |
|
Ah thats good news. Will upgrade soon. |