Mailing List Archive

IP Phone Service to update a Translation Pattern or CTI Route Point via AXL?
Hi all,

Has anyone done an phone button that they can use to update a CTI Route Point and another button to change it back?

For example, update a CTI RP Call-Forward-All destination and then another button to turn it off?
Or if easier, update a Translation Pattern CalledPartyTransformation?

Cheers
Dana
Re: IP Phone Service to update a Translation Pattern or CTI Route Point via AXL? [ In reply to ]
I have done that before. Kind of like a night mode button. You could just
use a single button, and make it like a toggle, and as a part of the
action, change the line label for the SURL you're pressing. E.g., It would
say Turn On / Turn Off.

It requires a third server in the middle of the phone and the CUCM though.
The tech in the middle is unimportant, as long as it can accept and send
HTTP requests. E.g., node.js, EasyPHP, Python SimpleHTTPServer, etc.

On Mon, Feb 10, 2020 at 12:17 AM Dana Tong <dana.tong@yellit.com.au> wrote:

> Hi all,
>
>
>
> Has anyone done an phone button that they can use to update a CTI Route
> Point and another button to change it back?
>
>
>
> For example, update a CTI RP Call-Forward-All destination and then another
> button to turn it off?
>
> Or if easier, update a Translation Pattern CalledPartyTransformation?
>
>
>
> Cheers
>
> Dana
>
>
> _______________________________________________
> cisco-voip mailing list
> cisco-voip@puck.nether.net
> https://puck.nether.net/mailman/listinfo/cisco-voip
>
Re: IP Phone Service to update a Translation Pattern or CTI Route Point via AXL? [ In reply to ]
Here's a quick sample node.js app that will toggle a DN CFA setting between
2500 and Off, every time it's accessed, and display output as XML the IP
Phone can render (though, your browser will show it too).

You will need to install node.js and then using the node package manager
(npm) install both request and xml2js.

You will need to change the info for CUCM, DN and Node. The PKID for the
DN can be found in your browser location bar while looking at the DN
(alternative to using DN + Partition). The Node info is where you're
running Node and on what port.

To start node, use C:\>node yourfilename.js

You will see the URL to use in CUCM printed to the screen like this:

[image: image.png]

--- save the below output to a file with .js file extension...don't save
this line

// CUCM Info
var axl_host = '10.1.1.1';
var axl_user = 'node_axl';
var axl_pass = '!axl4node!';

// DN Info
var target_dn_pkid = '1ebe1462-9af3-8899-863b-af84ec591e4b';
var target_cfa_dest = '2500';

// Node Info
var node_server = '10.2.2.2';
var node_port = 8080;
var node_url = '/toggle';

// Required Libraries
var url = require('url');
var http = require('http');
var request = require('request');
var parseString = require('xml2js').parseString;

// Ignore Cert Warnings
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;

// Node HTTP Server Setup
var server = http.createServer(function (req, res) {
res.setHeader('Content-Type', 'text/xml');

// Only do anything on HTTP GET requests to our URL
if (req.method === 'GET' && req.url === node_url) {
var current_value = '';
var new_value = '';

// Ask AXL what the current forwarding status is
request.post({
url: 'https://' + axl_user + ':' + axl_pass + '@' + axl_host +
':8443/axl/',
headers: {
'Content-Type': 'text/xml;charset=UTF-8',
'SOAPAction': 'CUCM:DB ver=11.5 getLine',
},
body: `<soapenv:Envelope xmlns:soapenv="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="
http://www.cisco.com/AXL/API/11.5
"><soapenv:Header/><soapenv:Body><ns:getLine><uuid>{${target_dn_pkid}}</uuid><returnedTags><callForwardAll><destination>true</destination></callForwardAll></returnedTags></ns:getLine></soapenv:Body></soapenv:Envelope>`
},
function(error, response, body) {
parseString(body, function(error, result) {

// Set the new forwarding status opposite of its current
value (toggle it)
current_value =
result['soapenv:Envelope']['soapenv:Body'][0]['ns:getLineResponse'][0]['return'][0]['line'][0]['callForwardAll'][0]['destination'][0];
new_value = (current_value !== target_cfa_dest) ?
target_cfa_dest : '';

// Tell AXL to change the forwarding status
request.post({
url: 'https://' + axl_user + ':' + axl_pass + '@' +
axl_host + ':8443/axl/',
headers: {
'Content-Type': 'text/xml;charset=UTF-8',
'SOAPAction': 'CUCM:DB ver=11.5 updateLine',
},
body: `<soapenv:Envelope xmlns:soapenv="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="
http://www.cisco.com/AXL/API/11.5
"><soapenv:Header/><soapenv:Body><ns:updateLine><uuid>{${target_dn_pkid}}</uuid><callForwardAll><destination>${new_value}</destination></callForwardAll></ns:updateLine></soapenv:Body></soapenv:Envelope>`
},
function(error, response, body) {

// Tell the requesting device what we did
console.log(`flipped value from "${current_value}" to
"${new_value}"`);
res.write(`<?xml version="1.0" encoding="utf-8"
?><CiscoIPPhoneText><Title>Informational
Message</Title><Prompt></Prompt><Text>flipped value from "${current_value}"
to "${new_value}"</Text></CiscoIPPhoneText>`);
res.end();
});
});
});
}
});

// Open Port and Listen
server.listen(node_port, node_server, () => {
console.log(`Use this URL: http://
${node_server}:${node_port}${node_url}`);
});

--- this is the end...don't save this line either

On Mon, Feb 10, 2020 at 9:03 AM Anthony Holloway <
avholloway+cisco-voip@gmail.com> wrote:

> I have done that before. Kind of like a night mode button. You could
> just use a single button, and make it like a toggle, and as a part of the
> action, change the line label for the SURL you're pressing. E.g., It would
> say Turn On / Turn Off.
>
> It requires a third server in the middle of the phone and the CUCM
> though. The tech in the middle is unimportant, as long as it can accept
> and send HTTP requests. E.g., node.js, EasyPHP, Python SimpleHTTPServer,
> etc.
>
> On Mon, Feb 10, 2020 at 12:17 AM Dana Tong <dana.tong@yellit.com.au>
> wrote:
>
>> Hi all,
>>
>>
>>
>> Has anyone done an phone button that they can use to update a CTI Route
>> Point and another button to change it back?
>>
>>
>>
>> For example, update a CTI RP Call-Forward-All destination and then
>> another button to turn it off?
>>
>> Or if easier, update a Translation Pattern CalledPartyTransformation?
>>
>>
>>
>> Cheers
>>
>> Dana
>>
>>
>> _______________________________________________
>> cisco-voip mailing list
>> cisco-voip@puck.nether.net
>> https://puck.nether.net/mailman/listinfo/cisco-voip
>>
>