I'm transferring some calls to SIP/ Phono clients along with some custom headers. How can I read these headers ? So far I could find [1] only how to set the headers but not how to read them.
I'm transferring some calls to SIP/ Phono clients along with some custom headers. How can I read these headers ? So far I could find [1] only how to set the headers but not how to read them.
The link below should help.
https://www.tropo.com/docs/scripting/advanced-call-control/sip-headers-retrieving-sending
I'm wondering if phono has a method to retrieve them just as tropo does. The reason is that I need to retrieve the headers on the client (phono) so that I can populate the screen with some meta data.
I see. I did a bunch of testing and I was able to extract the headers that I sent in. First off, the app will need to have an 'x-' in front of the name of the header. You can find what my tropo app looks like below:
call("sip:phono_address@pgw-v11f.phono.com", array(
"headers" => array("x-test1"=>"value1", "x-test2" => "value2")
));
There are already headers inside of Phono, so what I did in Phono was iterate through all of the headers and alert the screen to the ones that I sent in the browser. You can find my onIncomingCall function below:
phone: {
onIncomingCall: function(event) {
$("#waitings").attr("disabled", true).val("waiting");
$("#incoming").attr("disabled", false).val("Answer");
$("#incoming").click(event.call.answer());
var incr = 1;
for (i = 0; i < event.call.headers.length; i++) {
if(event.call.headers[i]["name"] != "x-accountid" && event.call.headers[i]["name"] != "x-joinsid" && event.call.headers[i]["name"] != "x-appid" && event.call.headers[i]["name"] != "x-sid" && event.call.headers[i]["name"] != "x-vdirect"){
alert("here are the headers ----- "+ incr+") " + event.call.headers[i]["name"] + " === " + event.call.headers[i]["value"]);
incr += 1;
}
}
}
}
});
Looking at both blocks of code, My Phono will send two alerts since I sent two headers. Can you please give that a try and let us know if you have any other questions or concerns!