Module: sems Branch: master Commit: a643451c18df27c3acbea1f5b749c291a5415bf5 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=a643451c18df27c3acbea1f5b749c291a5415bf5
Author: Stefan Sayer <[email protected]> Committer: Stefan Sayer <[email protected]> Date: Fri Nov 19 14:15:23 2010 +0100 add standard REFER as option to pin_collect --- apps/ivr/Ivr.cpp | 4 ++++ apps/ivr/Ivr.h | 1 + apps/ivr/IvrDialogBase.cpp | 23 +++++++++++++++++++++++ apps/pin_collect/etc/pin_collect.conf | 2 ++ apps/pin_collect/pin_collect.py | 7 +++++++ doc/Readme.pin_collect.txt | 9 ++++++--- 6 files changed, 43 insertions(+), 3 deletions(-) diff --git a/apps/ivr/Ivr.cpp b/apps/ivr/Ivr.cpp index 71624ad..988028c 100644 --- a/apps/ivr/Ivr.cpp +++ b/apps/ivr/Ivr.cpp @@ -534,6 +534,10 @@ int IvrDialog::transfer(const string& target) return dlg.transfer(target); } +int IvrDialog::refer(const string& target, int expires) { + return dlg.refer(target, expires); +} + int IvrDialog::drop() { int res = dlg.drop(); diff --git a/apps/ivr/Ivr.h b/apps/ivr/Ivr.h index bc0ed9b..1054346 100644 --- a/apps/ivr/Ivr.h +++ b/apps/ivr/Ivr.h @@ -141,6 +141,7 @@ class IvrDialog : public AmB2BCallerSession void setPyPtrs(PyObject *mod, PyObject *dlg); int transfer(const string& target); + int refer(const string& target, int expires); int drop(); void onSessionStart(const AmSipRequest& req); diff --git a/apps/ivr/IvrDialogBase.cpp b/apps/ivr/IvrDialogBase.cpp index 578e486..f258e9e 100644 --- a/apps/ivr/IvrDialogBase.cpp +++ b/apps/ivr/IvrDialogBase.cpp @@ -495,6 +495,26 @@ IvrDialogBase_redirect(IvrDialogBase *self, PyObject* args) } +static PyObject* +IvrDialogBase_refer(IvrDialogBase *self, PyObject* args) +{ + assert(self->p_dlg); + + char* refer_to=0; + int expires; + if(!PyArg_ParseTuple(args,"si",&refer_to, &expires)) + return NULL; + + if(self->p_dlg->refer(refer_to, expires)){ + ERROR("REFER failed\n"); + return NULL; + } + + Py_INCREF(Py_None); + return Py_None; + +} + static PyMethodDef IvrDialogBase_methods[] = { @@ -528,6 +548,9 @@ static PyMethodDef IvrDialogBase_methods[] = { "Send a BYE" }, {"redirect", (PyCFunction)IvrDialogBase_redirect, METH_VARARGS, + "Transfers the remote party to some third party." + }, + {"refer", (PyCFunction)IvrDialogBase_refer, METH_VARARGS, "Refers the remote party to some third party." }, {"dropSession", (PyCFunction)IvrDialogBase_dropSession, METH_NOARGS, diff --git a/apps/pin_collect/etc/pin_collect.conf b/apps/pin_collect/etc/pin_collect.conf index 85efb71..a22aec6 100644 --- a/apps/pin_collect/etc/pin_collect.conf +++ b/apps/pin_collect/etc/pin_collect.conf @@ -2,6 +2,8 @@ # authentication mode: # XMLRPC : authenticate against XMLRPC server # REFER : add pin to REFER sent out to be checked at proxy +# TRANSFER : add pin to R-URI, transfer call flow (see Readme.pin_collect.txt) + auth_mode=XMLRPC # XMLRPC url to authenticate against if auth_mode==XMLRPC diff --git a/apps/pin_collect/pin_collect.py b/apps/pin_collect/pin_collect.py index a2c10c8..af53173 100644 --- a/apps/pin_collect/pin_collect.py +++ b/apps/pin_collect/pin_collect.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from log import * from ivr import * @@ -101,6 +102,12 @@ class IvrDialog(IvrDialogBase): self.fail_msg.open(config['fail_msg'],AUDIO_READ) self.enqueue(self.fail_msg,None) + elif config['auth_mode'] == 'REFER': + self.state = connect + self.removeTimer(HINT_TIMER) + self.transfer_cseq = self.dialog.cseq + self.refer("sip:" + self.dialog.user + "+" + self.keys + "@" + \ + self.dialog.domain, 20) else: self.state = connect self.removeTimer(HINT_TIMER) diff --git a/doc/Readme.pin_collect.txt b/doc/Readme.pin_collect.txt index 446b90d..8ce7ceb 100644 --- a/doc/Readme.pin_collect.txt +++ b/doc/Readme.pin_collect.txt @@ -10,11 +10,14 @@ Authentication Modes: XMLRPC : Authenticate against an XMLRPC server (python example server in test/authserver.py - REFER : the transfer request (REFER) sent out has as user part of + REFER : The Refer-to of the REFER sent in-dialog contains <user>+<pin>@domain, + such that this pin can be checked by an upstream app server or + proxy and acted upon (e.g. sent to the proper conference room). + + TRANSFER : the transfer request (Transfer REFER) sent out has as user part of the URI the original user part, a plus sign, and the entered PIN. The PIN can thus be verified by the proxy handling the - transfer REFER. - + transfer REFER. See below for an explanation. "Transfer" REFER: The "Transfer REFER" is a proprietary REFER call flow which transfers a _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
