summaryrefslogtreecommitdiff
path: root/pjsip-apps
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-03-18 12:29:01 +0000
committerBenny Prijono <bennylp@teluu.com>2006-03-18 12:29:01 +0000
commitaf42396b96e653beab3b6707c12a467c3d397f98 (patch)
tree1d0803509ecede1d96bbea1d634a00c932761e6c /pjsip-apps
parent5d98d9ed57823080f63434018847cd438b1894c5 (diff)
Added comment on how to add credentials and route set in the dialog
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@332 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip-apps')
-rw-r--r--pjsip-apps/src/samples/simpleua.c64
1 files changed, 63 insertions, 1 deletions
diff --git a/pjsip-apps/src/samples/simpleua.c b/pjsip-apps/src/samples/simpleua.c
index ae90cd8d..df4337d9 100644
--- a/pjsip-apps/src/samples/simpleua.c
+++ b/pjsip-apps/src/samples/simpleua.c
@@ -319,6 +319,50 @@ int main(int argc, char *argv[])
return 1;
}
+ /* If we expect the outgoing INVITE to be challenged, then we should
+ * put the credentials in the dialog here, with something like this:
+ *
+ {
+ pjsip_cred_info cred[1];
+
+ cred[0].realm = pj_str("sip.server.realm");
+ cred[0].username = pj_str("theuser");
+ cred[0].data_type = PJSIP_CRED_DATA_PLAIN_PASSWD;
+ cred[0].data = pj_str("thepassword");
+
+ pjsip_auth_clt_set_credentials( &dlg->auth_sess, 1, cred);
+ }
+ *
+ */
+
+
+ /* If we want the initial INVITE to travel to specific SIP proxies,
+ * then we should put the initial dialog's route set here. The final
+ * route set will be updated once a dialog has been established.
+ * To set the dialog's initial route set, we do it with something
+ * like this:
+ *
+ {
+ pjsip_route_hdr route_set;
+ pjsip_route_hdr *route;
+ const pj_str_t hname = { "Route", 5 };
+ char *uri = "sip:proxy.server;lr";
+
+ pj_list_init(&route_set);
+
+ route = pjsip_parse_hdr( dlg->pool, &hname,
+ uri, strlen(uri),
+ NULL);
+ PJ_ASSERT_RETURN(route != NULL, 1);
+ pj_list_push_back(&route_set, route);
+
+ pjsip_dlg_set_route_set(dlg, &route_set);
+ }
+ *
+ * Note that Route URI SHOULD have an ";lr" parameter!
+ */
+
+
/* Get the SDP body to be put in the outgoing INVITE, by asking
* media endpoint to create one for us. The SDP will contain all
* codecs that have been registered to it (in this case, only
@@ -340,7 +384,6 @@ int main(int argc, char *argv[])
PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
-
/* Create initial INVITE request.
* This INVITE request will contain a perfectly good request and
* an SDP body as well.
@@ -372,6 +415,25 @@ int main(int argc, char *argv[])
pjsip_endpt_handle_events(g_endpt, &timeout);
}
+ /* On exit, dump memory usage: */
+ {
+ pj_pool_t *p;
+ unsigned total_alloc = 0;
+ unsigned total_used = 0;
+
+ /* Accumulate memory usage in active list. */
+ p = cp.used_list.next;
+ while (p != (pj_pool_t*) &cp.used_list) {
+ total_alloc += pj_pool_get_capacity(p);
+ total_used += pj_pool_get_used_size(p);
+ p = p->next;
+ }
+
+ printf("Total pool memory allocated=%d KB, used=%d KB\n",
+ total_alloc / 1000,
+ total_used / 1000);
+ }
+
return 0;
}