diff --git a/library/MGCP_Emulation.ttcn b/library/MGCP_Emulation.ttcn index 2ab566957..b16474876 100644 --- a/library/MGCP_Emulation.ttcn +++ b/library/MGCP_Emulation.ttcn @@ -48,10 +48,11 @@ type record MGCP_conn_parameters { uint16_t mgw_udp_port } -function main(MGCP_conn_parameters p, charstring id) runs on MGCP_Emulation_CT { +function main(MGCPOps ops, MGCP_conn_parameters p, charstring id) runs on MGCP_Emulation_CT { var Result res; g_mgcp_id := id; //f_conn_table_init(); + f_expect_table_init(); map(self:MGCP, system:MGCP_CODEC_PT); res := MGCP_CodecPort_CtrlFunct.f_IPL4_connect(MGCP, p.mgw_ip, @@ -65,6 +66,10 @@ p.mgw_udp_port, } [] MGCP.receive(MGCP_RecvFrom:?) { } + [] PROC.getcall(MGCPEM_register:{?,?}) -> param(crit, vc_conn) { + f_create_expect(crit, vc_conn); + PROC.reply(MGCPEM_register:{crit, vc_conn}); + } } } } @@ -72,18 +77,18 @@ p.mgw_udp_port, /* "Expect" Handling */ /* */ -type union ExpectCriteria { - MgcpConnectionId connid, - MgcpEndpoint endpoint, - MgcpTransId transid +type record ExpectCriteria { + MgcpConnectionId connid optional, + MgcpEndpoint endpoint optional, + MgcpTransId transid optional } type record ExpectData { ExpectCriteria crit optional, - MGCP_ConnHdlr vc_conn optional + MGCP_ConnHdlr vc_conn } -signature MGCPEM_register(in MgcpCommand cmd, in MGCP_ConnHdlr hdlr); +signature MGCPEM_register(in ExpectCriteria cmd, in MGCP_ConnHdlr hdlr); type port MGCPEM_PROC_PT procedure { inout MGCPEM_register; @@ -107,18 +112,19 @@ runs on MGCP_Emulation_CT return MGCP_ConnHdlr { /* Ensure cmd is a CRCX? */ for (i := 0; i < sizeof(ExpectTable); i := i+1) { - if (not ispresent(ExpectTable[i].vc_conn)) { + if (not ispresent(ExpectTable[i].crit)) { continue; } - mgcpcmd := f_get_mgcp_by_crit(ExpectTable[i].crit); - if (match(cmd, mgcpcmd)) { + /* FIXME: Ignore criteria for now */ +// mgcpcmd := f_get_mgcp_by_crit(ExpectTable[i].crit); +// if (match(cmd, mgcpcmd)) { ret := ExpectTable[i].vc_conn; /* Release this entry */ ExpectTable[i].crit := omit; ExpectTable[i].vc_conn := null; log("Found Expect[", i, "] for ", cmd, " handled at ", ret); return ret; - } +// } } setverdict(fail, "Couldn't find Expect for CRCX", cmd); return ret; @@ -146,4 +152,12 @@ runs on MGCP_Emulation_CT { setverdict(fail, "No space left in ExpectTable") } +private function f_expect_table_init() +runs on MGCP_Emulation_CT { + var integer i; + for (i := 0; i < sizeof(ExpectTable); i := i + 1) { + ExpectTable[i].crit := omit; + } +} + }