/** * Check sessions * * Designed to be called within a debugger session in order * to display information regarding "interesting" sessions */ void CheckSessions() { SESSION *list_session; int noclients = 0; int norouter = 0; spinlock_acquire(&session_spin); list_session = allSessions; while (list_session) { if (list_session->state != SESSION_STATE_LISTENER || list_session->state != SESSION_STATE_LISTENER_STOPPED) { if (list_session->client_dcb == NULL && list_session->refcount) { if (noclients == 0) { printf("Sessions without a client DCB.\n"); printf("==============================\n"); } printSession(list_session); noclients++; } } list_session = list_session->next; } spinlock_release(&session_spin); if (noclients) { printf("%d Sessions have no clients\n", noclients); } spinlock_acquire(&session_spin); list_session = allSessions; while (list_session) { if (list_session->state != SESSION_STATE_LISTENER || list_session->state != SESSION_STATE_LISTENER_STOPPED) { if (list_session->router_session == NULL && list_session->refcount) { if (norouter == 0) { printf("Sessions without a router session.\n"); printf("==================================\n"); } printSession(list_session); norouter++; } } list_session = list_session->next; } spinlock_release(&session_spin); if (norouter) { printf("%d Sessions have no router session\n", norouter); } }
/** * Check sessions * * Designed to be called within a debugger session in order * to display information regarding "interesting" sessions */ void CheckSessions() { SESSION *ptr; int noclients = 0; int norouter = 0; spinlock_acquire(&session_spin); ptr = allSessions; while (ptr) { if (ptr->state != SESSION_STATE_LISTENER || ptr->state != SESSION_STATE_LISTENER_STOPPED) { if (ptr->client == NULL && ptr->refcount) { if (noclients == 0) { printf("Sessions without a client DCB.\n"); printf("==============================\n"); } printSession(ptr); noclients++; } } ptr = ptr->next; } spinlock_release(&session_spin); if (noclients) printf("%d Sessions have no clients\n", noclients); spinlock_acquire(&session_spin); ptr = allSessions; while (ptr) { if (ptr->state != SESSION_STATE_LISTENER || ptr->state != SESSION_STATE_LISTENER_STOPPED) { if (ptr->router_session == NULL && ptr->refcount) { if (norouter == 0) { printf("Sessions without a router session.\n"); printf("==================================\n"); } printSession(ptr); norouter++; } } ptr = ptr->next; } spinlock_release(&session_spin); if (norouter) printf("%d Sessions have no router session\n", norouter); }
/** * Print all sessions * * Designed to be called within a debugger session in order * to display all active sessions within the gateway */ void printAllSessions() { SESSION *list_session; spinlock_acquire(&session_spin); list_session = allSessions; while (list_session) { printSession(list_session); list_session = list_session->next; } spinlock_release(&session_spin); }
/** * Print all sessions * * Designed to be called within a debugger session in order * to display all active sessions within the gateway */ void printAllSessions() { SESSION *ptr; spinlock_acquire(&session_spin); ptr = allSessions; while (ptr) { printSession(ptr); ptr = ptr->next; } spinlock_release(&session_spin); }
int Sdp::createLocalSession(const CodecOrder &selectedCodecs) { setLocalMediaCapabilities(selectedCodecs); localSession_ = PJ_POOL_ZALLOC_T(memPool_, pjmedia_sdp_session); if (!localSession_) { ERROR("Could not create local SDP session"); return !PJ_SUCCESS; } localSession_->conn = PJ_POOL_ZALLOC_T(memPool_, pjmedia_sdp_conn); /* Initialize the fields of the struct */ localSession_->origin.version = 0; pj_time_val tv; pj_gettimeofday(&tv); localSession_->origin.user = pj_str(pj_gethostname()->ptr); // Use Network Time Protocol format timestamp to ensure uniqueness. localSession_->origin.id = tv.sec + 2208988800UL; localSession_->origin.net_type = pj_str((char*)"IN"); localSession_->origin.addr_type = pj_str((char*)"IP4"); localSession_->origin.addr = pj_str((char*)localIpAddr_.c_str()); localSession_->name = pj_str((char*)"sflphone"); localSession_->conn->net_type = localSession_->origin.net_type; localSession_->conn->addr_type = localSession_->origin.addr_type; localSession_->conn->addr = localSession_->origin.addr; // RFC 3264: An offer/answer model session description protocol // As the session is created and destroyed through an external signaling mean (SIP), the line // should have a value of "0 0". localSession_->time.start = 0; localSession_->time.stop = 0; // For DTMF RTP events localSession_->media_count = 1; localSession_->media[0] = setMediaDescriptorLine(); if (!srtpCrypto_.empty()) addSdesAttribute(srtpCrypto_); DEBUG("Local SDP Session:"); printSession(localSession_); return pjmedia_sdp_validate(localSession_); }
void Sdp::receiveOffer(const pjmedia_sdp_session* remote, const CodecOrder &selectedCodecs) { if (!remote) { ERROR("Remote session is NULL"); return; } DEBUG("Remote SDP Session:"); printSession(remote); if (localSession_ == NULL && createLocalSession(selectedCodecs) != PJ_SUCCESS) { ERROR("Failed to create initial offer"); return; } remoteSession_ = pjmedia_sdp_session_clone(memPool_, remote); if (pjmedia_sdp_neg_create_w_remote_offer(memPool_, localSession_, remoteSession_, &negotiator_) != PJ_SUCCESS) { ERROR("Could not create negotiator with remote offer"); negotiator_ = NULL; } }