summaryrefslogtreecommitdiff
path: root/pjsip/src/pjsip-simple
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2008-07-01 19:11:55 +0000
committerBenny Prijono <bennylp@teluu.com>2008-07-01 19:11:55 +0000
commitd7c460ac3d5b5c97f9452809b4c9818f18a9f067 (patch)
tree9fe86ca034d22f54441cee4f2bba6a2d274dfcdc /pjsip/src/pjsip-simple
parent5c50c25acb9d1c7e6c92dedb796023594dafa162 (diff)
Ticket #553: PUBLISH callback is not called when authentication fails (thanks Ruud Klaver for the report)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2095 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsip-simple')
-rw-r--r--pjsip/src/pjsip-simple/publishc.c45
1 files changed, 16 insertions, 29 deletions
diff --git a/pjsip/src/pjsip-simple/publishc.c b/pjsip/src/pjsip-simple/publishc.c
index a6206061..072a08d0 100644
--- a/pjsip/src/pjsip-simple/publishc.c
+++ b/pjsip/src/pjsip-simple/publishc.c
@@ -435,19 +435,15 @@ static void pubc_refresh_timer_cb( pj_timer_heap_t *timer_heap,
entry->id = 0;
status = pjsip_publishc_publish(pubc, 1, &tdata);
- if (status == PJ_SUCCESS) {
- status = pjsip_publishc_send(pubc, tdata);
- }
-
- // Callback should have been called.
- // Calling it here will crash the system since pubc might have been
- // destroyed
- //
- //if (status != PJ_SUCCESS) {
- // char errmsg[PJ_ERR_MSG_SIZE];
- // pj_str_t reason = pj_strerror(status, errmsg, sizeof(errmsg));
- // call_callback(pubc, status, 400, &reason, NULL, -1);
- //}
+ if (status != PJ_SUCCESS) {
+ char errmsg[PJ_ERR_MSG_SIZE];
+ pj_str_t reason = pj_strerror(status, errmsg, sizeof(errmsg));
+ call_callback(pubc, status, 400, &reason, NULL, -1);
+ return;
+ }
+
+ status = pjsip_publishc_send(pubc, tdata);
+ /* No need to call callback as it should have been called */
}
static void tsx_callback(void *token, pjsip_event *event)
@@ -478,22 +474,13 @@ static void tsx_callback(void *token, pjsip_event *event)
rdata,
tsx->last_tx,
&tdata);
-
- if (status == PJ_SUCCESS) {
- status = pjsip_publishc_send(pubc, tdata);
- }
-
- // Callback should have been called.
- // Calling it here will crash the system since pubc might have been
- // destroyed
- //
- //if (status != PJ_SUCCESS) {
- // call_callback(pubc, status, tsx->status_code,
- // &rdata->msg_info.msg->line.status.reason,
- // rdata, -1);
- //}
-
- return;
+ if (status != PJ_SUCCESS) {
+ call_callback(pubc, status, tsx->status_code,
+ &rdata->msg_info.msg->line.status.reason,
+ rdata, -1);
+ } else {
+ status = pjsip_publishc_send(pubc, tdata);
+ }
} else {
pjsip_rx_data *rdata;