[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue Aug 24 13:56:05 CDT 2010


branch "master" has been updated
       via  d34a07273a0c02273546841de634ec8ddb5fde29 (commit)
       via  9c2bf0fffa0576fab5c9df0eb96cfc9ec6cab6e1 (commit)
      from  0cc8a3f0a384aed099383f2cec42115d086941b4 (commit)

Summary of changes:
 src/SipEndpoint.cpp |  124 +++++++++++++++++++++++++++++++--------------------
 1 files changed, 75 insertions(+), 49 deletions(-)


- Log -----------------------------------------------------------------
commit d34a07273a0c02273546841de634ec8ddb5fde29
Author: Joshua Colp <jcolp at digium.com>
Date:   Tue Aug 24 16:07:44 2010 -0300

    Flush out more of the stubs. All the ones currently needed are implemented. SDP stuff does still need to be done, though.

diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index e1bab5d..38893ba 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -57,9 +57,12 @@ public:
 	}
 	void terminate(const Core::Endpoint::V1::EndpointIdPtr& caller, const Ice::Current&)
 	{
-		//stub
-		//What's the difference between this and
-		//SignalCallback::terminated()?
+	   pjsip_tx_data *packet;
+
+	   if ((pjsip_inv_end_session(mEndpoint->getInviteSession(), 503, NULL, &packet)) == PJ_SUCCESS)
+	   {
+	      pjsip_inv_send_msg(mEndpoint->getInviteSession(), packet);
+	   }
 	}
 
 private:
@@ -78,33 +81,24 @@ public:
 	{
 	   pjsip_tx_data *packet;
 
-	   if ((pjsip_inv_end_session(mEndpoint->getInviteSession(), 180, NULL, &packet)) == PJ_SUCCESS)
+	   if ((pjsip_inv_answer(mEndpoint->getInviteSession(), 180, NULL, NULL, &packet)) == PJ_SUCCESS)
 	   {
 	      pjsip_inv_send_msg(mEndpoint->getInviteSession(), packet);
 	   }
 	}
 	void connected(const Core::Endpoint::V1::EndpointIdPtr& ep, const Ice::Current&)
 	{
-		//stub
-		//Similar to ring()
-		//Except here, I'll most likely also be
-		//including an SDP answer, or an SDP offer
-		//in some odd situations.
+	   // TODO: Produce SDP to fill in here
+
+	   pjsip_tx_data *packet;
+	   if ((pjsip_inv_answer(mEndpoint->getInviteSession(), 200, NULL, NULL, &packet)) == PJ_SUCCESS)
+	   {
+	      pjsip_inv_send_msg(mEndpoint->getInviteSession(), packet);
+	   }
 	}
 	void terminated(const Core::Endpoint::V1::EndpointIdPtr& ep, const Hydra::Session::V1::ResponseCodePtr& response, const Ice::Current&)
 	{
-		//stub
-		//There was some confusion about this when Ken and
-		//I were talking recently. Depending on how this
-		//works, I'll either generate a BYE request, or
-		//respond to an BYE request with a 200 OK.
-		//For generating BYE:
-		//Look up SessionEndpoint
-		//Get PJSipManager and get pjsip_endpoint
-		//Get INVITE transaction and dialog
-		//pjsip_dlg_create_request
-		//pjsip_dlg_send_request
-		//pjsip_dlg_dec_session
+	   // This is a notification that the remote side hung up but is NOT a command telling us to terminate the call
 	}
 	void busy(const Core::Endpoint::V1::EndpointIdPtr& ep, const Ice::Current&)
 	{
@@ -127,32 +121,41 @@ public:
 	}
 	void hold(const Core::Endpoint::V1::EndpointIdPtr& ep, const Ice::Current&)
 	{
-		//stub
-		//This one's interesting. Like with
-		//terminated(), we'll be sending a request.
-		//However, we'll be sending a reinvite instead
-		//and attaching an SDP with a sendonly attribute.
-		//Now that I'm looking at PJSIP some more, it
-		//may be worthwhile to use the INVITE session
-		//API instead of the base dialog API. It may
-		//be a bit inflexible though.
+	   // TODO: Update SDP with sendonly attribute and no IP
+
+	   // TODO: This is actually passing the hold through, we will need to support local generation
+
+	   pjsip_tx_data *packet;
+	   if ((pjsip_inv_reinvite(mEndpoint->getInviteSession(), NULL, NULL, &packet)) == PJ_SUCCESS)
+	   {
+	      pjsip_inv_send_msg(mEndpoint->getInviteSession(), packet);
+	   }
 	}
 	void unhold(const Core::Endpoint::V1::EndpointIdPtr& ep, const Ice::Current&)
 	{
-		//stub
-		//Similar to hold() but use sendrcv attribute
-		//for reinvite.
+	   // TODO: Update SDP with sendrecv and IP
+
+	   // TODO: This is actually passing the unhold through, we will need to support local generation
+
+	   pjsip_tx_data *packet;
+	   if ((pjsip_inv_reinvite(mEndpoint->getInviteSession(), NULL, NULL, &packet)) == PJ_SUCCESS)
+	   {
+	      pjsip_inv_send_msg(mEndpoint->getInviteSession(), packet);
+	   }
 	}
 	void flash(const Core::Endpoint::V1::EndpointIdPtr& ep, const Ice::Current&)
 	{
-		//stub
-		//I...don't know :(
+	   // This is usually transported using INFO or RFC2833, so for now just pretend it does not exist
 	}
 	void progress(const Core::Endpoint::V1::EndpointIdPtr& ep, const Hydra::Session::V1::ResponseCodePtr& response, const Ice::Current&)
 	{
-		//stub
-		//Similar to connected(), but the response code
-		//will be 183 instead of 200.
+	   // TODO: Produce SDP to pass in here
+
+	   pjsip_tx_data *packet;
+	   if ((pjsip_inv_answer(mEndpoint->getInviteSession(), 183, NULL, NULL, &packet)) == PJ_SUCCESS)
+	   {
+	      pjsip_inv_send_msg(mEndpoint->getInviteSession(), packet);
+	   }
 	}
 
 private:

commit 9c2bf0fffa0576fab5c9df0eb96cfc9ec6cab6e1
Author: Joshua Colp <jcolp at digium.com>
Date:   Tue Aug 24 15:43:06 2010 -0300

    Fill in some of the 'call' function.

diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index e70df85..e1bab5d 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -15,22 +15,45 @@ public:
 
 	bool call(const Core::Endpoint::V1::EndpointIdPtr& caller, const Core::Endpoint::V1::EndpointIdPtr& destination, const Hydra::Session::V1::SignalCallbackPtr& callback, const Ice::Current&)
 	{
-		// Create a UAC dialog for the outgoing call
+	   pj_str_t local_uri, remote_uri;
+	   pjsip_dialog *dialog;
 
-		// Produce SDP to attach to the outgoing INVITE
+	   // TODO: Populate local and remote URI with actual sane values
 
-		// Create an INVITE session
+	   // Create a UAC dialog for the outgoing call
+	   if ((pjsip_dlg_create_uac(pjsip_ua_instance(), &local_uri, &local_uri, &remote_uri, &remote_uri, &dialog)) != PJ_SUCCESS)
+	   {
+	      return false;
+	   }
 
-		// Create the actual INVITE packet
+	   // TODO: Produce SDP to attach to the outgoing INVITE
 
-		// Boom! Houston, we have transmission.
+	   // Create an INVITE session
+	   pjsip_inv_session *inviteSession;
+	   if ((pjsip_inv_create_uac(dialog, NULL, 0, &inviteSession)) != PJ_SUCCESS)
+	   {
+	      pjsip_dlg_terminate(dialog);
+	      return false;
+	   }
 
-		//stub
-		//I'm not sure what this callback is supposed to do. Am
-		//I supposed to make an outgoing call? If so, what am
-		//I supposed to do with the "caller" and "callback"
-		//parameters?
-		return true;
+	   // Create the actual INVITE packet
+	   pjsip_tx_data *packet;
+	   if ((pjsip_inv_invite(inviteSession, &packet)) != PJ_SUCCESS)
+	   {
+	      pjsip_inv_terminate(inviteSession, 500, 0);
+	      pjsip_dlg_terminate(dialog);
+	      return false;
+	   }
+
+	   // Before we send the message we probably should populate the endpoint data... just in case
+	   mEndpoint->setDialog(dialog);
+	   mEndpoint->setInviteSession(inviteSession);
+
+	   // Boom! Houston, we have transmission.
+	   pjsip_inv_send_msg(inviteSession, packet);
+
+	   // TODO: Store the signal callback pointer so that results of this outgoing leg can be interpreted and reflected
+	   return true;
 	}
 	void terminate(const Core::Endpoint::V1::EndpointIdPtr& caller, const Ice::Current&)
 	{

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list