Module: sems Branch: master Commit: fbc489ba01863c28a068cf2753ac549f23e229dd URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=fbc489ba01863c28a068cf2753ac549f23e229dd
Author: Raphael Coeffic <[email protected]> Committer: Raphael Coeffic <[email protected]> Date: Tue Sep 20 15:50:48 2011 +0200 added UAS transaction fetching functions. also removed duplicated UAC transaction fetching functions. --- core/AmSession.cpp | 2 +- core/AmSipDialog.cpp | 42 ++++++++++++++++++++---------------------- core/AmSipDialog.h | 17 ++++++++--------- 3 files changed, 29 insertions(+), 32 deletions(-) diff --git a/core/AmSession.cpp b/core/AmSession.cpp index f2c02b4..888ce6f 100644 --- a/core/AmSession.cpp +++ b/core/AmSession.cpp @@ -880,7 +880,7 @@ void AmSession::onSipReply(const AmSipReply& reply, void AmSession::onInvite2xx(const AmSipReply& reply) { - if(dlg.get_uac_trans(reply.cseq)) + if(dlg.getUACTrans(reply.cseq)) dlg.send_200_ack(reply.cseq); } diff --git a/core/AmSipDialog.cpp b/core/AmSipDialog.cpp index 3a804fc..087823c 100644 --- a/core/AmSipDialog.cpp +++ b/core/AmSipDialog.cpp @@ -951,12 +951,31 @@ bool AmSipDialog::getUACTransPending() { bool AmSipDialog::getUACInvTransPending() { for (TransMap::iterator it=uac_trans.begin(); it != uac_trans.end(); it++) { - if (it->second.method == "INVITE") + if (it->second.method == SIP_METH_INVITE) return true; } return false; } +AmSipTransaction* AmSipDialog::getUASTrans(unsigned int t_cseq) +{ + TransMap::iterator it = uas_trans.find(t_cseq); + if(it == uas_trans.end()) + return NULL; + + return &(it->second); +} + +AmSipTransaction* AmSipDialog::getPendingUASInv() +{ + for (TransMap::iterator it=uas_trans.begin(); + it != uas_trans.end(); it++) { + if (it->second.method == SIP_METH_INVITE) + return &(it->second); + } + return NULL; +} + string AmSipDialog::getContactHdr() { if(contact_uri.empty()) { @@ -1589,27 +1608,6 @@ void AmSipDialog::rel100OnRequestOut(const string &method, string &hdrs) } } - -string AmSipDialog::get_uac_trans_method(unsigned int t_cseq) -{ - TransMap::iterator t = uac_trans.find(t_cseq); - - if (t != uac_trans.end()) - return t->second.method; - - return ""; -} - -AmSipTransaction* AmSipDialog::get_uac_trans(unsigned int t_cseq) -{ - TransMap::iterator t = uac_trans.find(t_cseq); - - if (t != uac_trans.end()) - return &(t->second); - - return NULL; -} - int AmSipDialog::drop() { status = Disconnected; diff --git a/core/AmSipDialog.h b/core/AmSipDialog.h index 789ffce..dbbdea9 100644 --- a/core/AmSipDialog.h +++ b/core/AmSipDialog.h @@ -224,15 +224,21 @@ private: AmSipDialog(AmSipDialogEventHandler* h); ~AmSipDialog(); - /** @return transaction coresponding to cseq or NULL */ + /** @return UAC transaction coresponding to cseq or NULL */ AmSipTransaction* getUACTrans(unsigned int t_cseq); /** @return whether UAC transaction is pending */ bool getUACTransPending(); - /** @return whether INVITE transaction is pending */ + /** @return whether UAC INVITE transaction is pending */ bool getUACInvTransPending(); + /** @return UAS transaction coresponding to cseq or NULL */ + AmSipTransaction* getUASTrans(unsigned int t_cseq); + + /** @return a pending UAS INVITE transaction or NULL */ + AmSipTransaction* getPendingUASInv(); + Status getStatus() { return status; } const char* getStatusStr(); @@ -334,13 +340,6 @@ private: int drop(); /** - * @return the method of the corresponding uac request - */ - string get_uac_trans_method(unsigned int t_cseq); - - AmSipTransaction* get_uac_trans(unsigned int t_cseq); - - /** * This method should only be used to send responses * to requests which are not referenced by any dialog. * _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
