#define NTA_AGENT_MAGIC_T agent_t
#define NTA_LEG_MAGIC_T agent_t
#define NTA_OUTGOING_MAGIC_T client_t
-#define NTA_OUTGOING_MAGIC_T0 agent_t
#define NTA_INCOMING_MAGIC_T agent_t
#define NTA_RELIABLE_MAGIC_T agent_t
#include "sofia-sip/nta.h"
-#include "nta_internal.h"
+#include "sofia-sip/nta_tport.h"
#include <sofia-sip/sip_header.h>
#include <sofia-sip/sip_tag.h>
#include <sofia-sip/sip_status.h>
int c_errors;
};
+struct invite_client_t {
+ client_t ic_client[1];
+ nta_outgoing_t *ic_orq; /* Original INVITE transaction */
+ int ic_tag_status; /* Status for current branch */
+ char *ic_tag;
+};
+
struct agent_t {
su_home_t ag_home[1];
int ag_flags;
nta_leg_t *ag_expect_leg;
nta_leg_t *ag_latest_leg;
nta_leg_t *ag_call_leg;
- nta_leg_t *ag_tag_remote; /**< If this is set, outgoing_callback()
- * tags it with the tag from remote.
- */
nta_reliable_t *ag_reliable;
sip_via_t *ag_in_via; /**< Incoming via */
NULL
};
+/** Callback from client transaction */
int outgoing_callback(client_t *ctx,
nta_outgoing_t *orq,
sip_t const *sip)
/* Send message from Alice to Bob establishing the dialog */
ag->ag_expect_leg = ag->ag_server_leg;
- ag->ag_tag_remote = ag->ag_alice_leg;
ctx->c_orq =
nta_outgoing_tcreate(ag->ag_alice_leg, outgoing_callback, ctx,
ag->ag_obp,
END();
}
-struct invite_client_t {
- client_t ic_client[1];
- nta_outgoing_t *ic_orq; /* Original INVITE transaction */
- int ic_tag_status; /* Status for current branch */
- char *ic_tag;
-};
-
static
int invite_client_deinit(client_t *c)
{
BEGIN();
{
- invite_client_t ic[1] = {{
- {{ ag, "Call 1", NULL, checks_for_invite, invite_client_deinit }} }};
+ invite_client_t ic[1] =
+ {{{{ ag, "Call 1", NULL, checks_for_invite, invite_client_deinit }}}};
client_t *ctx = ic->ic_client;
/*
/* Try to CANCEL it immediately */
TEST_1(nta_outgoing_cancel(ctx->c_orq) == 0);
/* As Bob immediately answers INVITE with 200 Ok,
- cancel should be answered with 481 and 200 Ok is teruned to INVITE. */
+ cancel should be answered with 481 and 200 Ok is returned to INVITE. */
TEST_1(!client_run(ctx, 200));
TEST_P(ag->ag_latest_leg, ag->ag_server_leg);
}
TEST_1(r1 = nta_leg_make_replaces(ag->ag_alice_leg, ag->ag_home, 0));
- TEST_1(r2 = sip_replaces_format(ag->ag_home, "%s;from-tag=%s;to-tag=%s",
- r1->rp_call_id, r1->rp_to_tag, r1->rp_from_tag));
+ TEST_1(r2 = sip_replaces_format(ag->ag_home,
+ "%s;from-tag=%s;to-tag=%s",
+ r1->rp_call_id,
+ r1->rp_to_tag,
+ r1->rp_from_tag));
TEST_P(ag->ag_alice_leg, nta_leg_by_replaces(ag->ag_agent, r2));
TEST_P(ag->ag_bob_leg, nta_leg_by_replaces(ag->ag_agent, r1));
{
- invite_client_t ic[1] = {{
- {{ ag, "Re-INVITE in Call 1", NULL, checks_for_reinvite, invite_client_deinit }}
- }};
+ invite_client_t ic[1] =
+ {{{{
+ ag, "Re-INVITE in Call 1",
+ NULL, checks_for_reinvite, invite_client_deinit
+ }}}};
client_t *ctx = ic->ic_client;
/* Re-INVITE from Bob to Alice.
END();
}
-/* ============================================================================ */
+/* ========================================================================== */
/* Test early dialogs, PRACK */
int test_for_ack_or_timeout(agent_t *ag,
ic->ic_tag,
sip->sip_rseq);
TEST_1(orq);
- nta_outgoing_destroy(ctx->c_orq);
+ if (ic->ic_orq != ctx->c_orq)
+ nta_outgoing_destroy(ctx->c_orq);
ctx->c_orq = orq;
TEST_1(ctx->c_checks && ctx->c_checks[0] == check_orq_tagging);
/* Send INVITE */
{
- invite_client_t ic[1] = {{ {{ ag, "Call 2", NULL, checks_for_100rel, invite_client_deinit }} }};
+ invite_client_t ic[1] =
+ {{{{ ag, "Call 2", NULL, checks_for_100rel, invite_client_deinit }}}};
client_t *ctx = ic->ic_client;
nta_leg_bind(ag->ag_server_leg, bob_leg_callback2, ag);
TEST_1(nta_leg_tag(ag->ag_alice_leg, NULL));
{
- invite_client_t ic[1] = {{ {{ ag, "Call 2b", cancel_invite, checks_for_invite, invite_client_deinit }} }};
+ invite_client_t ic[1] =
+ {{{{
+ ag, "Call 2b",
+ cancel_invite, checks_for_invite, invite_client_deinit
+ }}}};
client_t *ctx = ic->ic_client;
/* Send INVITE */
TEST_1(nta_leg_tag(ag->ag_alice_leg, NULL));
{
- invite_client_t ic[1] = {{ {{ ag, "Call 3", NULL, checks_for_invite, invite_client_deinit }} }};
+ invite_client_t ic[1] =
+ {{{{ ag, "Call 3", NULL, checks_for_invite, invite_client_deinit }}}};
client_t *ctx = ic->ic_client;
/* Send INVITE,
* client timeouts after timer C
*/
- invite_client_t ic[1] = {{
- {{ ag, "Call 4", NULL, checks_for_100rel, invite_client_deinit }}
- }};
+ invite_client_t ic[1] =
+ {{{{ ag, "Call 4", NULL, checks_for_100rel, invite_client_deinit }}}};
client_t *ctx = ic->ic_client;
printf("%s: starting timer C, test will complete in 1 seconds\n",
ag->ag_bob_leg = NULL;
{
- invite_client_t ic[1] = {{
- {{ ag, "Call 5", NULL, checks_for_100rel, invite_client_deinit }}
- }};
+ invite_client_t ic[1] =
+ {{{{ ag, "Call 5", NULL, checks_for_100rel, invite_client_deinit }}}};
client_t *ctx = ic->ic_client;
/* Send INVITE */