📄 fsm_uas4inv.c
字号:
/* The oSIP library implements the Session Initiation Protocol (SIP -rfc2543-) Copyright (C) 2001 Aymeric MOIZARD jack@atosc.org This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*/#include <stdlib.h>#include <stdio.h>#include "fsm.h"#include <osip/port.h>#include <osip/ua.h>static statemachine_t *uas_4inv;statemachine_t *fsm_getfsm_uas4inv(){ return uas_4inv;}intfsm_load_uas4inv() { transition_t *transition; uas_4inv = (statemachine_t *) smalloc(sizeof(statemachine_t)); uas_4inv->transitions = (list_t *) smalloc(sizeof(list_t)); list_init(uas_4inv->transitions); transition = (transition_t *) smalloc(sizeof(transition_t)); transition->state = INITIAL; transition->type = RCV_REQINVITE; transition->method = (void(*)(void *,void *))&uas_rcvrequest; list_add(uas_4inv->transitions,transition,-1); transition = (transition_t *) smalloc(sizeof(transition_t)); transition->state = PROCEEDING; transition->type = RCV_REQINVITE; transition->method = (void(*)(void *,void *))&uas_i_rcvretransmitrequest; list_add(uas_4inv->transitions,transition,-1); transition = (transition_t *) smalloc(sizeof(transition_t)); transition->state = PROCEEDING; transition->type = SND_STATUS_1XX; transition->method = (void(*)(void *,void *))&uas_send1XX; list_add(uas_4inv->transitions,transition,-1); transition = (transition_t *) smalloc(sizeof(transition_t)); transition->state = PROCEEDING; transition->type = SND_STATUS_23456XX; transition->method = (void(*)(void *,void *))&uas_send23456XX; list_add(uas_4inv->transitions,transition,-1); transition = (transition_t *) smalloc(sizeof(transition_t)); transition->state = ANSWERED; transition->type = RCV_REQINVITE; transition->method = (void(*)(void *,void *))&uas_i_rcvretransmitrequest; list_add(uas_4inv->transitions,transition,-1); transition = (transition_t *) smalloc(sizeof(transition_t)); transition->state = ANSWERED; transition->type = TIMEOUT; transition->method = (void(*)(void *,void *))&uas_i_retransmitresponse; list_add(uas_4inv->transitions,transition,-1); transition = (transition_t *) smalloc(sizeof(transition_t)); transition->state = ANSWERED; transition->type = RCV_REQACK; transition->method = (void(*)(void *,void *))&uas_i_rcvack; list_add(uas_4inv->transitions,transition,-1); return 0;}voiduas_i_rcvretransmitrequest(sipevent_t *sipevent,transaction_t *transaction){ ua_retransmitresponse(sipevent,transaction);}voiduas_i_retransmitresponse(sipevent_t *sipevent,transaction_t *transaction){ if (udp_send_response(transaction->lastresponse)==-1) { TRACE(trace(__FILE__,__LINE__,TRACE_LEVEL1,NULL,"Error while retransmitting final response")); if (((osip_t *)transaction->config)->cb_network_error != NULL) ((osip_t *)transaction->config)->cb_network_error(transaction); return; } /* invoke the right callback! */ if (((osip_t *)transaction->config)->cb_sndresp_retransmission != NULL) ((osip_t *)transaction->config)->cb_sndresp_retransmission(transaction);}voiduas_i_rcvack(sipevent_t *sipevent,transaction_t *transaction){ DEBUG(msg_logrequest(sipevent->sip,"RCV %s f:%s t:%s cseq:%s callid:%s\n")); if (transaction->lastrequest!=NULL) { msg_free(transaction->lastrequest); sfree(transaction->lastrequest); } transaction->lastrequest = sipevent->sip; /* invoke the right callback! */ if (((osip_t *)transaction->config)->cb_rcvack != NULL) ((osip_t *)transaction->config)->cb_rcvack(sipevent,transaction); transaction->completed_time = time(NULL); transaction->state = COMPLETED; return ;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -