summaryrefslogtreecommitdiff
path: root/pjsip
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2008-07-10 20:45:03 +0000
committerBenny Prijono <bennylp@teluu.com>2008-07-10 20:45:03 +0000
commit5297036bb4d751faf3dad72bdb22fd622e27b7c4 (patch)
tree804d5b7b6895dad3a9e7d5e469af5374c60bb67d /pjsip
parent110237399dcdb73e45945ab995fff97dc493b81a (diff)
Ticket 555: modifications to pjsua instant messaging callbacks
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2118 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r--pjsip/include/pjsua-lib/pjsua.h29
-rw-r--r--pjsip/src/pjsua-lib/pjsua_im.c29
-rw-r--r--pjsip/src/pjsua-lib/pjsua_pres.c4
3 files changed, 56 insertions, 6 deletions
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h
index 06853b81..cbda0587 100644
--- a/pjsip/include/pjsua-lib/pjsua.h
+++ b/pjsip/include/pjsua-lib/pjsua.h
@@ -833,6 +833,7 @@ typedef struct pjsua_callback
# contact: string
# mime_type: string
# body: string
+ # acc_id: integer
def on_pager(call_id, from, to, contact, mime_type, body):
return
@@ -855,11 +856,12 @@ typedef struct pjsua_callback
* @param mime_type MIME type of the message.
* @param body The message content.
* @param rdata The incoming MESSAGE request.
+ * @param acc_id Account ID most suitable for this message.
*/
void (*on_pager2)(pjsua_call_id call_id, const pj_str_t *from,
const pj_str_t *to, const pj_str_t *contact,
const pj_str_t *mime_type, const pj_str_t *body,
- pjsip_rx_data *rdata);
+ pjsip_rx_data *rdata, pjsua_acc_id acc_id);
/**
* Notify application about the delivery status of outgoing pager
@@ -884,6 +886,7 @@ typedef struct pjsua_callback
# user_data: string
# status: integer
# reason: string
+ # acc_id: integer
def on_pager_status(call_id, to, body, user_data, status, reason):
return
@@ -913,6 +916,8 @@ typedef struct pjsua_callback
* @param rdata The incoming MESSAGE response, or NULL if the
* message transaction fails because of time out
* or transport error.
+ * @param acc_id Account ID from this the instant message was
+ * send.
*/
void (*on_pager_status2)(pjsua_call_id call_id,
const pj_str_t *to,
@@ -921,7 +926,8 @@ typedef struct pjsua_callback
pjsip_status_code status,
const pj_str_t *reason,
pjsip_tx_data *tdata,
- pjsip_rx_data *rdata);
+ pjsip_rx_data *rdata,
+ pjsua_acc_id acc_id);
/**
* Notify application about typing indication.
@@ -952,6 +958,25 @@ typedef struct pjsua_callback
pj_bool_t is_typing);
/**
+ * Notify application about typing indication.
+ *
+ * @param call_id Containts the ID of the call where the IM was
+ * sent, or PJSUA_INVALID_ID if the IM was sent
+ * outside call context.
+ * @param from URI of the sender.
+ * @param to URI of the destination message.
+ * @param contact The Contact URI of the sender, if present.
+ * @param is_typing Non-zero if peer is typing, or zero if peer
+ * has stopped typing a message.
+ * @param rdata The received request.
+ * @param acc_id Account ID most suitable for this message.
+ */
+ void (*on_typing2)(pjsua_call_id call_id, const pj_str_t *from,
+ const pj_str_t *to, const pj_str_t *contact,
+ pj_bool_t is_typing, pjsip_rx_data *rdata,
+ pjsua_acc_id acc_id);
+
+ /**
* Callback when the library has finished performing NAT type
* detection.
*
diff --git a/pjsip/src/pjsua-lib/pjsua_im.c b/pjsip/src/pjsua-lib/pjsua_im.c
index f993ff90..065999fc 100644
--- a/pjsip/src/pjsua-lib/pjsua_im.c
+++ b/pjsip/src/pjsua-lib/pjsua_im.c
@@ -191,6 +191,21 @@ void pjsua_im_process_pager(int call_id, const pj_str_t *from,
is_typing);
}
+ if (pjsua_var.ua_cfg.cb.on_typing2) {
+ pjsua_acc_id acc_id;
+
+ if (call_id == PJSUA_INVALID_ID) {
+ acc_id = pjsua_acc_find_for_incoming(rdata);
+ } else {
+ pjsua_call *call = &pjsua_var.calls[call_id];
+ acc_id = call->acc_id;
+ }
+
+
+ (*pjsua_var.ua_cfg.cb.on_typing2)(call_id, from, to, &contact,
+ is_typing, rdata, acc_id);
+ }
+
} else {
pj_str_t mime_type;
char buf[256];
@@ -219,8 +234,18 @@ void pjsua_im_process_pager(int call_id, const pj_str_t *from,
}
if (pjsua_var.ua_cfg.cb.on_pager2) {
+ pjsua_acc_id acc_id;
+
+ if (call_id == PJSUA_INVALID_ID) {
+ acc_id = pjsua_acc_find_for_incoming(rdata);
+ } else {
+ pjsua_call *call = &pjsua_var.calls[call_id];
+ acc_id = call->acc_id;
+ }
+
(*pjsua_var.ua_cfg.cb.on_pager2)(call_id, from, to, &contact,
- &mime_type, &text_body, rdata);
+ &mime_type, &text_body, rdata,
+ acc_id);
}
}
}
@@ -389,7 +414,7 @@ static void im_callback(void *token, pjsip_event *e)
tsx->status_code,
&tsx->status_text,
tsx->last_tx,
- rdata);
+ rdata, im_data->acc_id);
}
}
}
diff --git a/pjsip/src/pjsua-lib/pjsua_pres.c b/pjsip/src/pjsua-lib/pjsua_pres.c
index 9763f930..c7a3ffc4 100644
--- a/pjsip/src/pjsua-lib/pjsua_pres.c
+++ b/pjsip/src/pjsua-lib/pjsua_pres.c
@@ -505,7 +505,7 @@ static void pres_evsub_on_srv_state( pjsip_evsub *sub, pjsip_event *event)
uapres = (pjsua_srv_pres*) pjsip_evsub_get_mod_data(sub, pjsua_var.mod.id);
if (uapres) {
- PJ_LOG(3,(THIS_FILE, "Server subscription to %s is %s",
+ PJ_LOG(4,(THIS_FILE, "Server subscription to %s is %s",
uapres->remote, pjsip_evsub_get_state_name(sub)));
if (pjsip_evsub_get_state(sub) == PJSIP_EVSUB_STATE_TERMINATED) {
@@ -983,7 +983,7 @@ static void pjsua_evsub_on_state( pjsip_evsub *sub, pjsip_event *event)
buddy = (pjsua_buddy*) pjsip_evsub_get_mod_data(sub, pjsua_var.mod.id);
if (buddy) {
- PJ_LOG(3,(THIS_FILE,
+ PJ_LOG(4,(THIS_FILE,
"Presence subscription to %.*s is %s",
(int)pjsua_var.buddy[buddy->index].uri.slen,
pjsua_var.buddy[buddy->index].uri.ptr,