summaryrefslogtreecommitdiff
path: root/res/res_pjsip.c
diff options
context:
space:
mode:
authorTorrey Searle <torrey@voxbone.com>2017-06-26 14:52:52 +0200
committerGeorge Joseph <gjoseph@digium.com>2017-08-01 15:41:53 -0600
commit65c560894d0d53167af9c6013c7f93703ebb6722 (patch)
tree9338ffeb939a3b0b3866241d8005dd2d2bd50e45 /res/res_pjsip.c
parentb3914df10bbb61494f3023a8a22894e4aeeadf05 (diff)
chan_pjsip: add a new function PJSIP_DTMF_MODE
This function is a replica of SIPDtmfMode, allowing the DTMF mode of a PJSIP call to be modified on a per-call basis ASTERISK-27085 #close Change-Id: I20eef5da3e5d1d3e58b304416bc79683f87e7612
Diffstat (limited to 'res/res_pjsip.c')
-rw-r--r--res/res_pjsip.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index 02112113c..f3648acdb 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -4483,6 +4483,56 @@ const char *ast_sip_get_host_ip_string(int af)
return NULL;
}
+int ast_sip_dtmf_to_str(const enum ast_sip_dtmf_mode dtmf,
+ char *buf, size_t buf_len)
+{
+ switch (dtmf) {
+ case AST_SIP_DTMF_NONE:
+ ast_copy_string(buf, "none", buf_len);
+ break;
+ case AST_SIP_DTMF_RFC_4733:
+ ast_copy_string(buf, "rfc4733", buf_len);
+ break;
+ case AST_SIP_DTMF_INBAND:
+ ast_copy_string(buf, "inband", buf_len);
+ break;
+ case AST_SIP_DTMF_INFO:
+ ast_copy_string(buf, "info", buf_len);
+ break;
+ case AST_SIP_DTMF_AUTO:
+ ast_copy_string(buf, "auto", buf_len);
+ break;
+ case AST_SIP_DTMF_AUTO_INFO:
+ ast_copy_string(buf, "auto_info", buf_len);
+ break;
+ default:
+ buf[0] = '\0';
+ return -1;
+ }
+ return 0;
+}
+
+int ast_sip_str_to_dtmf(const char * dtmf_mode)
+{
+ int result = -1;
+
+ if (!strcasecmp(dtmf_mode, "info")) {
+ result = AST_SIP_DTMF_INFO;
+ } else if (!strcasecmp(dtmf_mode, "rfc4733")) {
+ result = AST_SIP_DTMF_RFC_4733;
+ } else if (!strcasecmp(dtmf_mode, "inband")) {
+ result = AST_SIP_DTMF_INBAND;
+ } else if (!strcasecmp(dtmf_mode, "none")) {
+ result = AST_SIP_DTMF_NONE;
+ } else if (!strcasecmp(dtmf_mode, "auto")) {
+ result = AST_SIP_DTMF_AUTO;
+ } else if (!strcasecmp(dtmf_mode, "auto_info")) {
+ result = AST_SIP_DTMF_AUTO_INFO;
+ }
+
+ return result;
+}
+
/*!
* \brief Set name and number information on an identity header.
*