sip header
Available in REST API Version 2 and later.Describes a SIP header. SIP headers can be sent by a connect or an answer action. If the service has been configured to report received SIP headers, any matching SIP headers will be included in the call info.
Used in class call info.
Used by actions answer and connect.
Only non-standard SIP headers should be sent. Sending standard SIP headers will usually cause the call to fail.
The handling of non-standard SIP headers is dependent on the entities the SIP messages pass through, such as proxies and back-to-back user agents, and the receiving SIP endpoint. It is recommended that only a single header of each name is sent and that all names are prefixed with "X-". This will increase the likelyhood of the headers reaching the intended target.
language wrappers and examples
It contains the following properties:
Property | Required/Optional | Description |
---|---|---|
name | required | The name of the SIP header. |
value | required | The value of the SIP header. |
-
Examples:
-
A SIP header object:
{ "name" : "X-AccountInfo", "value" : "abc-123456789" }
-
-
SIPHeader Class
Namespace: Aculab.Cloud.RestAPIWrapper
Assembly: Aculab.Cloud.RestAPIWrapper.dllA base class representing a SIP Header.
-
public class SIPHeader { // Constructors public SIPHeader(string name, string value); // Members public string Name; public string Value; }
Examples:
-
Add an extra SIP header to an answer action:
var answer = new Answer(); answer.AddExtraSIPHeader(new SIPHeader("X-AccountInfo", "abc-123456789"));
-
-
public class SIPHeader { // Constructors public SIPHeader(string name, string value); // Members public string Name; public string Value; }
Examples:
-
Add an extra SIP header to an answer action:
var answer = new Answer(); answer.AddExtraSIPHeader(new SIPHeader("X-AccountInfo", "abc-123456789"));
-
-
public class SIPHeader { // Constructors public SIPHeader(string name, string value); // Members public string Name; public string Value; }
Examples:
-
Add an extra SIP header to an answer action:
var answer = new Answer(); answer.AddExtraSIPHeader(new SIPHeader("X-AccountInfo", "abc-123456789"));
-
-
-
SIPHeader Class
Namespace: Aculab.Cloud.RestAPIWrapper
Assembly: Aculab.Cloud.RestAPIWrapper.dllA base class representing a SIP Header.
-
Public Class SIPHeader ' Constructors Public Sub New (name As String, value As String) ' Members Public Property Name As String Public Property Value As String End Class
Examples:
-
Add an extra SIP header to an answer action:
Dim answer = New Answer() answer.AddExtraSIPHeader(New SIPHeader("X-AccountInfo", "abc-123456789"))
-
-
Public Class SIPHeader ' Constructors Public Sub New (name As String, value As String) ' Members Public Property Name As String Public Property Value As String End Class
Examples:
-
Add an extra SIP header to an answer action:
Dim answer = New Answer() answer.AddExtraSIPHeader(New SIPHeader("X-AccountInfo", "abc-123456789"))
-
-
-
class SIPHeader
A class representing a SIP Header.
Class synopsis:
// Constructors: public SIPHeader(String name, String value) // Members: public String getName() public String getValue()
Examples:
-
Add an extra SIP header to an answer action:
Answer answerAction = new Answer(); answerAction.addExtraSIPHeader(new SIPHeader("X-AccountInfo", "abc-123456789"));
-
-
To send extra SIP headers, use the
Answer.add_extra_sip_header()
andConnect.add_extra_sip_header()
instance methods.Received SIP headers are found in the
Call Info
dictionary, accessed using thereceived_sip_headers
key. Thereceived_sip_headers
value is a list of dictionaries. Each dictionary contains aname
andvalue
key, representing a SIP header.Examples:
-
Add an extra SIP header to an answer action:
answer_action = Answer() answer_action.add_extra_sip_header("X-AccountInfo", "abc-123456789")
-
Extract the details from a speech object with confidence set (final result):
my_request = TelephonyRequest(request) action_result = my_request.get_action_result() if action_result.get("action") == "get_input": result = action_result.get("result") if result.get("input_type") == "speech": phrases = result.get("speech_input") for phrase in phrases: alternatives = phrase.get("alternatives") for alternative in alternatives: if 'confidence' in alternative: text = alternative.get("text") confidence = alternative.get("confidence") print("text={} confidence={}".format(text, confidence))
-
Extract the details from a speech object without confidence set (interim result):
my_request = TelephonyRequest(request) action_result = my_request.get_action_result() if action_result.get("action") == "get_input": result = action_result.get("result") if result.get("input_type") == "speech": phrases = result.get("speech_input") for phrase in phrases: alternatives = phrase.get("alternatives") for alternative in alternatives: if 'confidence' not in alternative: text = alternative.get("text") print("text={} confidence is null".format(text))
-
Extract the details from a speech object with a translation:
my_request = TelephonyRequest(request) action_result = my_request.get_action_result() if action_result.get("action") == "connect.translator": transcription_result = action_result.get("result") phrases = transcription_result.get("transcription") for phrase in phrases: final = phrase.get("final") if final: alternatives = phrase.get("alternatives") speech = alternatives[0] confidence = speech.get("confidence") text = speech.get("text") translation = speech.get("translation") # Your code here...
TelephonyRequest.get_action_result()
The Speech support class is represented by a dictionary. These may be found within the Action Result.
Examples:
-
-
This functionality is provided by function calls on various objects.
To send extra SIP headers, add them using
addExtraSIPHeader()
calls.
Received SIP header values are returned by callinggetReceivedSIPHeader()
onCallInfo
objects.Examples:
-
Add an extra SIP header to an answer action:
$answer = new \Aculab\TelephonyRestAPI\Answer(); $answer->addExtraSIPHeader("X-AccountInfo", "abc-123456789");
-