SipTransaction *SipCall::newRequest( SipCallMember *member, Sip::Method meth, const QString &body, const MimeContentType &bodytype, const SipUri &referto, const QString &proxyauthentication, const QString &authentication,int expiresTime, bool shortTr ){ SipTransaction *trans = new SipTransaction( lastseq++, member, this ); if( trans->sendRequest( meth, body, bodytype, referto, shortTr, proxyauthentication, authentication, expiresTime ) ) { if(meth == Sip::PRACK) { transactions.take(); //take out of queue, do NOT delete } else { transactions.clear(); } transactions.append( trans ); if ( meth == Sip::INVITE ) { member->saveinvite = trans; } // Audit the call auditCall(); // Return the transaction object for tracking return trans; } else { delete trans; return 0; }}
SipTransaction *SipCall::newPublish(SipCallMember *callMember,const QString state, const QString sipIfMatch, const SipUri &publishserver, int expiresTime, const QString &authentication, const QString &proxyauthentication, const QString &body){ transactions.clear(); localuri.setTag( QString::null ); callMember->setUri(localuri); SipTransaction *trans = new SipTransaction( lastseq++, callMember, this ); transactions.append( trans ); trans->sendPublish(state, sipIfMatch, publishserver, expiresTime, authentication, proxyauthentication, body ); return trans;}
SipTransaction *curtrans; for ( curtrans = transactions.first(); curtrans != 0; curtrans = transactions.next() ) { if (( incominguri == curtrans->getCallMember()->getUri()) && ( seqnum == curtrans->getSeqNum() ) && ( curtrans->getDirection() == SipTransaction::LocalRequest ) ) { SipCallMember *member = getMember( incominguri ); if( member == NULL ) { if(KStatics::debugLevel>=2) cout << "===SipCall::incomingRequest: member null - do nothing\n"; } else if( message || message->getStatus().getCode() == 202 ) { // Update the Contact for this member if( message->getContactList().getListLength() > 0 ) { member->setContactUri( message->getContactList().getHead() ); } // Update the route if( message->getRecordRoute().getListLength() > 0 ) { hasroute = true; route = message->getRecordRoute(); route.reverseList(); if( !route.getHead().uri().contains( ";lr" ) ) { route.addToEnd( member->getContactUri() ); } } } if( (message->getStatus().getCode() == 200 ) && (calltype == RegisterCall) ) { QString sr = message->getHeaderData( SipHeader::Service_Route); if (sr != "") { KStatics::serviceRoute = sr; } else { KStatics::serviceRoute = ""; } } curtrans->incomingResponse( message ); return; } }
QList<SipTransaction*>::iterator curtrans; for (curtrans = transactions.begin(); curtrans != transactions.end(); ++curtrans) { if (( incominguri == (*curtrans)->getCallMember()->getUri()) && ( seqnum == (*curtrans)->getSeqNum() ) && ( (*curtrans)->getDirection() == SipTransaction::LocalRequest ) ) { SipCallMember *member = getMember( incominguri ); if( member == NULL ) { if(KStatics::debugLevel>=2) cout << "===SipCall::incomingRequest: member null - do nothing\n"; } else if( message || message->getStatus().getCode() == 202 ) { // Update the Contact for this member if( message->getContactList().getListLength() > 0 ) { member->setContactUri( message->getContactList().getHead() ); } // Update the route if( message->getRecordRoute().getListLength() > 0 ) { hasroute = true; route = message->getRecordRoute(); route.reverseList(); if( !route.getHead().uri().contains( ";lr" ) ) { route.addToEnd( member->getContactUri() ); } } } if( (message->getStatus().getCode() == 200 ) && (calltype == RegisterCall) ) { QString sr = message->getHeaderData( SipHeader::Service_Route); if (sr != "") { KStatics::serviceRoute = sr; } else { KStatics::serviceRoute = ""; } } (*curtrans)->incomingResponse( message ); return; } }
SipTransaction *curtrans; if( ( message->getMethod() == Sip::ACK ) || ( message->getMethod() == Sip::CANCEL ) ) { for( curtrans = transactions.first(); curtrans != 0; curtrans = transactions.next() ) { if( ( incominguri == curtrans->getCallMember()->getUri() ) && ( seqnum == curtrans->getSeqNum() ) && ( curtrans->getDirection() == SipTransaction::RemoteRequest ) ) { //Request found curtrans->incomingRequest( message, true ); return 0; } } delete message; return 0; } for( curtrans = transactions.first(); curtrans != 0; curtrans = transactions.next() ) { if( ( incominguri == curtrans->getCallMember()->getUri() ) && ( seqnum == curtrans->getSeqNum() ) && ( seqmethod == curtrans->getSeqMethod() ) && ( curtrans->getDirection() == SipTransaction::RemoteRequest ) ) { curtrans->incomingRequestRetransmission( message ); return 0; } }
QList<SipTransaction*>::iterator curtrans; if( ( message->getMethod() == Sip::ACK ) || ( message->getMethod() == Sip::CANCEL ) ) { for (curtrans = transactions.begin(); curtrans != transactions.end(); ++curtrans) { if( ( incominguri == (*curtrans)->getCallMember()->getUri() ) && ( seqnum == (*curtrans)->getSeqNum() ) && ( (*curtrans)->getDirection() == SipTransaction::RemoteRequest ) ) { //Request found (*curtrans)->incomingRequest( message, true ); return 0; } } delete message; return 0; } for (curtrans = transactions.begin(); curtrans != transactions.end(); ++curtrans) { if( ( incominguri == (*curtrans)->getCallMember()->getUri() ) && ( seqnum == (*curtrans)->getSeqNum() ) && ( seqmethod == (*curtrans)->getSeqMethod() ) && ( (*curtrans)->getDirection() == SipTransaction::RemoteRequest ) ) { (*curtrans)->incomingRequestRetransmission( message ); return 0; } }
bool SipCallMember::sendRequestInvite( QString username, QString password ){ ourUsername=username; ourPassword=password; if( !username.isEmpty() && !password.isEmpty() && ( authstate == authState_AuthenticationRequired || authstate == authState_AuthenticationRequiredWithNewPassword || SipCallMember::authState_AuthenticationOK ) ) { ourUsername=username; ourPassword=password; proxyauthresponse=QString::null; authresponse=QString::null; if( authtype == DigestAuthenticationRequired ) { authresponse = Sip::getDigestResponse( username, password, "INVITE", getContactUri().theUri(), proxyauthstr,++nonceCounter ); } else if( authtype == ProxyDigestAuthenticationRequired ) { proxyauthresponse = Sip::getDigestResponse( username, password, "INVITE", getContactUri().theUri(), proxyauthstr,++nonceCounter ); } else if( authtype == ProxyBasicAuthenticationRequired ) { proxyauthresponse = Sip::getBasicResponse( username, password ); } local = call->newRequest( this, Sip::INVITE, localsessiondesc, localsessiontype, SipUri::null, proxyauthresponse,authresponse, localExpiresTime ); } else { local = call->newRequest( this, Sip::INVITE, localsessiondesc, localsessiontype, SipUri::null, QString::null, QString::null,localExpiresTime ); } if( localExpiresTime > 0 ) { //timer->start( localExpiresTime * 900, TRUE ); timer->start( localExpiresTime * 900 ); } if( local ) { op = opRequest; if( authstate == authState_AuthenticationRequired || authstate == authState_AuthenticationRequiredWithNewPassword ) { authstate = authState_AuthenticationTryingWithPassword; } else if( authstate == SipCallMember::authState_AuthenticationOK) { ; } else { authstate = authState_AuthenticationTrying; } connect( local, SIGNAL( statusUpdated() ), this, SLOT( localStatusUpdated() ) ); } else { return false; } return true;}
bool SipCallMember::requestInvite( const QString &body, const MimeContentType &bodytype ){ callMemberType = Invite; localsessiondesc = body; localsessiontype = bodytype; state = state_InviteRequested; return sendRequestInvite(ourUsername, ourPassword);}