[SIPForum-discussion] Invite request for HOLD

ashu sinha shsinha3 at gmail.com
Tue Jun 22 16:59:38 UTC 2010


Hi All,
          I am trying to achieve the HOLD functionality. I am using JAIN SIP
API. I got so many theory on how to achieve the hold functionality.
But, I am facing a problem that, I got information that I should sent Invite
Request using the same dialog for HOLD with a=sendonly and otherside send OK
with a=recvonly.
I am doing this but sending new invite i.e. from UI on pressing the hold
button, making the flow  same as for fresh Invite Request except the
attributes part(that is, sendonly, recvonly).


Here is the code that I am trying:-



if (request.getMethod().equals(Request. INVITE )) {

               if (serverTransaction.getDialog().getState() == null ) {

                    messageProcessor .processInvite(serverTransaction,
request); // this as you mentioned in your code



               } else {

                    *String rawContent
=serverTransaction.getRequest().getRawContent().toString();  *

                    javax.sdp.SessionDescription sessionDescription = null ;


                    try {

                         sessionDescription =
SdpFactory.getInstance().createSessionDescription(rawContent);



                         Vector<AttributeField> attributeFields =
sessionDescription.getAttributes( true );

                         String attributeType= "" ;

                         for ( int x=0; x<attributeFields.size(); x++){


attributeType=attributeFields.get(x).getName().trim().toLowerCase();


                              if (attributeType.equalsIgnoreCase( "sendrecv"
)||attributeType.equalsIgnoreCase( "sendonly" )
||attributeType.equalsIgnoreCase( "recvonly" ))

                                   break ;

                         }



                         if (attributeType.equalsIgnoreCase( "sendonly" )){

                              //We got a hold request,so we will send Ok to
other party with recvonly attribute

                              sipMeetingManager .sendHoldOk(serverTransaction,
request);

                         }

                         else if (attributeType.equalsIgnoreCase( "sendrecv")


                              //We got an *un *-hold request on basis of
sendrecv

                                                  sipMeetingManager
.sendUnHoldOk(serverTransaction,
request);

                         }

               } catch (Exception e){

                         e.printStackTrace();

                    }

                }

          }

So, I have created the functions sendHoldOk and SendUnholdOk by following
the same body as provided by you in Jain Sip.

The problem is in the red line above that after getting hold request it gets
hold but in this line it comes NULL POINTER EXCEPTION.



I am struggling to know that as there is way to know the transaction details
as happens in firstTransaction by using Dialog as:-
  dialog.getFirstTransaction().getRequest().getMethod().equals(Request. *INVITE
*).

So that we can easily send OK or ACK to the request.

 How I can know the other requests which are not under FirstTransaction so
that for HOLD and UNHOLD requests I can send the OK or ACK.



Can anybody suggest or help me in this regard..
Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sipforum.org/pipermail/discussion/attachments/20100622/ad2315a0/attachment-0002.html>


More information about the discussion mailing list