示例#1
0
文件: Dialog.c 项目: yjjfirst/x-sip
void DialogOk(struct Dialog *dialog)
{
    struct DialogId *id = GetDialogId(dialog);

    MESSAGE *message = BuildResponse(GetTransactionRequest(dialog->transaction),
                                     STATUS_CODE_OK);

    dialog->remoteSeqNumber = MessageGetCSeqNumber(GetTransactionRequest(dialog->transaction));     
    if (GetDialogState(dialog) == DIALOG_STATE_NON_EXIST) {
        SetLocalTag(id, MessageGetToTag(message));
        SetDialogState(dialog, DIALOG_STATE_CONFIRMED);
        SetLocalSeqNumber(dialog, MessageGetCSeqNumber(message)); 
        dialog->session = CreateSession();

    } else if (GetDialogState(dialog) == DIALOG_STATE_CONFIRMED) {
        if (DialogGetRequestMethod(dialog) == SIP_METHOD_BYE) {
            SetDialogState(dialog, DIALOG_STATE_TERMINATED);
        }
    }

    ResponseWith(dialog->transaction, message, TRANSACTION_SEND_OK);    
}
示例#2
0
Dialog* DLGImporter::GetDialog() const
{
	if(!Version) {
		return NULL;
	}
	Dialog* d = new Dialog();
	d->Flags = Flags;
	d->TopLevelCount = StatesCount;
	d->Order = (unsigned int *) calloc (StatesCount, sizeof(unsigned int *) );
	d->initialStates = (DialogState **) calloc (StatesCount, sizeof(DialogState *) );
	for (unsigned int i = 0; i < StatesCount; i++) {
		DialogState* ds = GetDialogState( d, i );
		d->initialStates[i] = ds;
	}
	return d;
}