Module: sems Branch: master Commit: 2bfe8ac9d8d51ac321460112c862d75152addcd9 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=2bfe8ac9d8d51ac321460112c862d75152addcd9
Author: Raphael Coeffic <[email protected]> Committer: Raphael Coeffic <[email protected]> Date: Tue Sep 20 16:09:00 2011 +0200 rtmp: improved error handling for dial function. --- apps/rtmp/RtmpConnection.cpp | 28 +++++++++++++++++++++++++--- apps/rtmp/flash_phone/sono.as | 16 ++++++++++++++-- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/apps/rtmp/RtmpConnection.cpp b/apps/rtmp/RtmpConnection.cpp index 87e7f4c..a7352ea 100644 --- a/apps/rtmp/RtmpConnection.cpp +++ b/apps/rtmp/RtmpConnection.cpp @@ -430,9 +430,31 @@ RtmpConnection::invoke(RTMPPacket *packet, unsigned int offset) } else if(AVMATCH(&method, &av_dial)) { - AVal uri; - AMFProp_GetString(AMF_GetProp(&obj, NULL, 3), &uri); - startSession(uri.av_val); + AVal uri={0,0}; + + if(obj.o_num > 3){ + AMFProp_GetString(AMF_GetProp(&obj, NULL, 3), &uri); + } + + if(!uri.av_len){ + // missing URI parameter + SendErrorResult(txn,"Sono.Call.NoUri"); + } + else { + m_session.lock(); + + if(session){ + SendErrorResult(txn,"Sono.Call.Existing"); + } + else { + session = startSession(uri.av_val); + if(!session) { + SendErrorResult(txn,"Sono.Call.Failed"); + } + } + + m_session.unlock(); + } } else if(AVMATCH(&method, &av_hangup)) { diff --git a/apps/rtmp/flash_phone/sono.as b/apps/rtmp/flash_phone/sono.as index c58028e..82af549 100644 --- a/apps/rtmp/flash_phone/sono.as +++ b/apps/rtmp/flash_phone/sono.as @@ -56,6 +56,17 @@ private function onConnectClick(evt:Event): void } } +private function onDialResult(res:Object):void +{ + +} + +private function onDialFault(error:Object):void +{ + g_dial_state = NOT_CONNECTED; + lStatus.text = "status: dial failed (" + error.code + ")"; +} + // bDial button has been clicked private function onDialClick(evt:Event): void { @@ -63,8 +74,9 @@ private function onDialClick(evt:Event): void return; if(g_dial_state == NOT_CONNECTED) { - //TODO: no responder yet: let's see if it's useful or not - g_netConnection.call('dial',null,dialUri.text); + g_netConnection.call('dial', + new Responder(onDialResult,onDialFault), + dialUri.text); g_dial_state = DIALING; lStatus.text = "status: dialing..."; } _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
