From 4ddc7a671445032792579c3cbde9aed3c913632d Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Thu, 8 Mar 2007 12:38:00 +0000 Subject: [PATCH] - suppressed all hard-coded "P-Iptel-..." and replaced through PARAM_HDR and APPNAME_HDR. - changed PARAM_HDR to "P-App-Param" - changed APPNAME_HDR to "P-App-Name" git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@272 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- apps/announce_transfer/AnnounceTransfer.cpp | 2 +- apps/conference/Conference.cpp | 4 ++-- apps/early_announce/EarlyAnnounce.cpp | 6 +++--- apps/ivr/Ivr.cpp | 4 ++-- apps/py_sems/Makefile | 4 +++- apps/voicemail/AnswerMachine.cpp | 6 +++--- core/AmSessionContainer.cpp | 4 ++-- core/AmSipDialog.cpp | 2 +- core/AmUtils.cpp | 2 +- core/AmUtils.h | 3 +++ doc/Readme.ivr | 4 ++-- 11 files changed, 23 insertions(+), 18 deletions(-) diff --git a/apps/announce_transfer/AnnounceTransfer.cpp b/apps/announce_transfer/AnnounceTransfer.cpp index fa1dad32..7f41a2ac 100644 --- a/apps/announce_transfer/AnnounceTransfer.cpp +++ b/apps/announce_transfer/AnnounceTransfer.cpp @@ -115,7 +115,7 @@ void AnnounceTransferDialog::onSessionStart(const AmSipRequest& req) callee_uri = getHeader(req.hdrs, "P-Refer-To"); if (callee_uri.length()) { INFO("Use of P-Refer-To header is deprecated. " - "Use 'P-Iptel-Param: Refer-To=' instead.\n"); + "Use '%s: Refer-To=' instead.\n",PARAM_HDR); } } if (!callee_uri.length()) diff --git a/apps/conference/Conference.cpp b/apps/conference/Conference.cpp index 8556f8d2..4541d56d 100644 --- a/apps/conference/Conference.cpp +++ b/apps/conference/Conference.cpp @@ -496,13 +496,13 @@ void ConferenceDialog::onSipRequest(const AmSipRequest& req) dlg.remote_tag = ""; // get route set and next hop - string iptel_app_param = getHeader(req.hdrs, "P-Iptel-Param"); + string iptel_app_param = getHeader(req.hdrs, PARAM_HDR); if (iptel_app_param.length()) { dlg.setRoute(get_header_keyvalue(iptel_app_param,"Transfer-RR")); dlg.next_hop = get_header_keyvalue(iptel_app_param,"Transfer-NH"); } else { INFO("Use of P-Transfer-RR/P-Transfer-NH is deprecated. " - "Use 'P-Iptel-Param: Transfer-RR=;Transfer-NH=' instead.\n"); + "Use '%s: Transfer-RR=;Transfer-NH=' instead.\n",PARAM_HDR); dlg.setRoute(getHeader(req.hdrs,"P-Transfer-RR")); dlg.next_hop = getHeader(req.hdrs,"P-Transfer-NH"); diff --git a/apps/early_announce/EarlyAnnounce.cpp b/apps/early_announce/EarlyAnnounce.cpp index d73aafeb..883080c6 100644 --- a/apps/early_announce/EarlyAnnounce.cpp +++ b/apps/early_announce/EarlyAnnounce.cpp @@ -163,7 +163,7 @@ void EarlyAnnounceDialog::process(AmEvent* event) unsigned int code_i = 404; string reason = "Not Found"; - string iptel_app_param = getHeader(localreq.hdrs, "P-Iptel-Param"); + string iptel_app_param = getHeader(localreq.hdrs, PARAM_HDR); if (iptel_app_param.length()) { string code = get_header_keyvalue(iptel_app_param,"Final-Reply-Code"); if (code.length() && str2i(code, code_i)) { @@ -179,8 +179,8 @@ void EarlyAnnounceDialog::process(AmEvent* event) string h_reason = getHeader(localreq.hdrs,"P-Final-Reply-Reason"); if (h_reason.length()) { INFO("Use of P-Final-Reply-Code/P-Final-Reply-Reason is deprecated. "); - INFO("Use 'P-Iptel-Param: Final-Reply-Code=;" - "Final-Reply-Reason=' instead.\n"); + INFO("Use '%s: Final-Reply-Code=;" + "Final-Reply-Reason=' instead.\n",PARAM_HDR); reason = h_reason; } } diff --git a/apps/ivr/Ivr.cpp b/apps/ivr/Ivr.cpp index 9578162f..8b10a1d9 100644 --- a/apps/ivr/Ivr.cpp +++ b/apps/ivr/Ivr.cpp @@ -118,12 +118,12 @@ extern "C" { return NULL; string res; - string iptel_app_param = getHeader(headers, "P-Iptel-Param"); + string iptel_app_param = getHeader(headers, PARAM_HDR); if (iptel_app_param.length()) { res = get_header_keyvalue(iptel_app_param,header_name); } else { INFO("Use of P-%s is deprecated. \n", header_name); - INFO("Use 'P-Iptel-Param: %s=' instead.\n", header_name); + INFO("Use '%s: %s=' instead.\n", PARAM_HDR, header_name); res = getHeader(headers,string("P-") + header_name); } diff --git a/apps/py_sems/Makefile b/apps/py_sems/Makefile index c48960c8..91b824bb 100644 --- a/apps/py_sems/Makefile +++ b/apps/py_sems/Makefile @@ -11,7 +11,9 @@ TTS ?= y # # PYTHON_VERSION might also be 2.2 -- except for the use of GIL # do a ls /usr/include/python2.3/Python.h to see if it's there -PY_VER = 2.3 +PYTHON_VERSION ?= 2.4 +PY_VER = $(PYTHON_VERSION) +PY_EXE = python$(PY_VER) # adjust to point to python include path # can also be /usr/include/python$(PY_VER) # look for Python.h in the specified path diff --git a/apps/voicemail/AnswerMachine.cpp b/apps/voicemail/AnswerMachine.cpp index 12c4bedb..15aa896b 100644 --- a/apps/voicemail/AnswerMachine.cpp +++ b/apps/voicemail/AnswerMachine.cpp @@ -147,7 +147,7 @@ AmSession* AnswerMachineFactory::onInvite(const AmSipRequest& req) string language; string email; - string iptel_app_param = getHeader(req.hdrs, "P-Iptel-Param"); + string iptel_app_param = getHeader(req.hdrs, PARAM_HDR); if (iptel_app_param.length()) { language = get_header_keyvalue(iptel_app_param,"Language"); @@ -158,8 +158,8 @@ AmSession* AnswerMachineFactory::onInvite(const AmSipRequest& req) if (email.length()) { INFO("Use of P-Email-Address/P-Language is deprecated. \n"); - INFO("Use 'P-Iptel-Param: Email-Address=;" - "Language=' instead.\n"); + INFO("Use '%s: Email-Address=;" + "Language=' instead.\n",PARAM_HDR); } } diff --git a/core/AmSessionContainer.cpp b/core/AmSessionContainer.cpp index 58d3fc17..c5c9644a 100644 --- a/core/AmSessionContainer.cpp +++ b/core/AmSessionContainer.cpp @@ -313,9 +313,9 @@ AmSession* AmSessionContainer::createSession(AmSipRequest& req) } else if(plugin_name == "sems"){ - plugin_name = getHeader(req.hdrs,"P-Iptel-App"); + plugin_name = getHeader(req.hdrs,APPNAME_HDR); if(plugin_name.empty()) - throw string("AmSessionContainer::createSession: missing 'P-Iptel-App' header.\n"); + throw string("AmSessionContainer::createSession: missing '%s' header.\n",APPNAME_HDR); } AmSessionFactory* state_factory = AmPlugIn::instance()->getFactory4App(plugin_name); diff --git a/core/AmSipDialog.cpp b/core/AmSipDialog.cpp index f31473bc..80451da3 100644 --- a/core/AmSipDialog.cpp +++ b/core/AmSipDialog.cpp @@ -493,7 +493,7 @@ int AmSipDialog::transfer(const string& target) } if (!(next_hop.empty() && route.empty())) { - hdrs = "P-Iptel-Param: "; + hdrs = PARAM_HDR ": "; if (!next_hop.empty()) hdrs+="Transfer-NH=\"" + next_hop +"\";"; diff --git a/core/AmUtils.cpp b/core/AmUtils.cpp index d9cde70f..ac415937 100644 --- a/core/AmUtils.cpp +++ b/core/AmUtils.cpp @@ -803,7 +803,7 @@ string get_header_keyvalue(const string& param_hdr, const string& name) { /** get the value of key @param name from P-Iptel-Param header in hdrs */ string get_session_param(const string& hdrs, const string& name) { - string iptel_app_param = getHeader(hdrs, "P-Iptel-Param"); + string iptel_app_param = getHeader(hdrs, PARAM_HDR); if (!iptel_app_param.length()) { // DBG("call parameters header P-Iptel-Param not found " // "(need to configure ser's tw_append?).\n"); diff --git a/core/AmUtils.h b/core/AmUtils.h index dfc0d485..9fa0a4d7 100644 --- a/core/AmUtils.h +++ b/core/AmUtils.h @@ -37,6 +37,9 @@ using std::string; #define FIFO_PERM S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH +#define PARAM_HDR "P-App-Param" +#define APPNAME_HDR "P-App-Name" + /** @file AmUtils.h */ /** diff --git a/doc/Readme.ivr b/doc/Readme.ivr index 3747f54b..c72b7dd9 100644 --- a/doc/Readme.ivr +++ b/doc/Readme.ivr @@ -52,13 +52,13 @@ there are quite a few possibilities to call a certain script: no matter which URI has been dialed. -* based on the "P-Iptel-App" header: +* based on the "P-App-Name" header: - in ser.cfg: t_write_unix("/tmp/sems_sock","sems") - the SIP message should contain following header: - P-Iptel-App: whatEverScriptYouWantToUse + P-App-Name: whatEverScriptYouWantToUse - this form will start the application/script mentioned in the header value.