Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
5e66024c
Commit
5e66024c
authored
Sep 08, 2010
by
Alexandre Savard
Browse files
[#3963] Add sender information in recipient-list and use it in display
parent
9c7828d9
Changes
5
Hide whitespace changes
Inline
Side-by-side
sflphone-common/src/dbus/callmanager.cpp
View file @
5e66024c
...
...
@@ -464,6 +464,6 @@ CallManager::setPBXEnrollment (const std::string& callID, const bool& yesNo)
void
CallManager
::
sendTextMessage
(
const
std
::
string
&
callID
,
const
std
::
string
&
message
)
{
if
(
!
Manager
::
instance
().
sendTextMessage
(
callID
,
message
))
if
(
!
Manager
::
instance
().
sendTextMessage
(
callID
,
message
,
"Me"
))
throw
CallManagerException
();
}
sflphone-common/src/managerimpl.cpp
View file @
5e66024c
...
...
@@ -1733,7 +1733,7 @@ void ManagerImpl::incomingMessage (const CallID& callID,
link
=
SIPVoIPLink
::
instance
(
""
);
// dynamic_cast<SIPVoIPLink *> (getAccountLink (*iter_participant));
if
(
link
)
link
->
sendTextMessage
(
*
iter_participant
,
message
);
link
->
sendTextMessage
(
*
iter_participant
,
message
,
from
);
}
iter_participant
++
;
...
...
@@ -1747,7 +1747,7 @@ void ManagerImpl::incomingMessage (const CallID& callID,
//THREAD=VoIP
bool
ManagerImpl
::
sendTextMessage
(
const
CallID
&
callID
,
const
std
::
string
&
message
)
bool
ManagerImpl
::
sendTextMessage
(
const
CallID
&
callID
,
const
std
::
string
&
message
,
const
std
::
string
&
from
)
{
SIPVoIPLink
*
link
=
NULL
;
...
...
@@ -1768,7 +1768,7 @@ bool ManagerImpl::sendTextMessage (const CallID& callID, const std::string& mess
if
(
link
)
link
->
sendTextMessage
(
*
iter_participant
,
message
);
link
->
sendTextMessage
(
*
iter_participant
,
message
,
from
);
iter_participant
++
;
}
...
...
@@ -1785,7 +1785,7 @@ bool ManagerImpl::sendTextMessage (const CallID& callID, const std::string& mess
}
_debug
(
"Manager: Send message to %s (%s)"
,
callID
.
c_str
(),
accountId
.
c_str
());
link
->
sendTextMessage
(
callID
,
message
);
link
->
sendTextMessage
(
callID
,
message
,
from
);
}
return
true
;
...
...
sflphone-common/src/managerimpl.h
View file @
5e66024c
...
...
@@ -448,11 +448,12 @@ class ManagerImpl
/**
* Send a new text message to the call, if participate to a conference, send to all participant.
* Send a new text message to the call, if participate to a conference, send to all participant.
* @param callID The call to send the message
* @param message The content of the message
*/
bool
sendTextMessage
(
const
CallID
&
callID
,
const
std
::
string
&
message
);
* @param from The sender of this message (could be another participant of a conference)
*/
bool
sendTextMessage
(
const
CallID
&
callID
,
const
std
::
string
&
message
,
const
std
::
string
&
from
);
/**
* Notify the client he has voice mails
...
...
sflphone-common/src/sip/sipvoiplink.cpp
View file @
5e66024c
...
...
@@ -1062,9 +1062,9 @@ SIPVoIPLink::onhold (const CallID& id)
}
bool
SIPVoIPLink
::
sendTextMessage
(
const
std
::
string
&
callID
,
const
std
::
string
&
message
)
SIPVoIPLink
::
sendTextMessage
(
const
std
::
string
&
callID
,
const
std
::
string
&
message
,
const
std
::
string
&
from
)
{
_debug
(
"SipVoipLink: Send text message to %s
"
,
callID
.
c_str
());
_debug
(
"SipVoipLink: Send text message to %s
, from %s"
,
callID
.
c_str
(),
from
.
c_str
());
SIPCall
*
call
=
getSIPCall
(
callID
);
pj_status_t
status
=
!
PJ_SUCCESS
;
...
...
@@ -1074,14 +1074,10 @@ SIPVoIPLink::sendTextMessage (const std::string& callID, const std::string& mess
/* Send IM message */
sfl
::
InstantMessaging
::
UriList
list
;
sfl
::
InstantMessaging
::
UriEntry
entry
1
;
entry
1
[
sfl
::
IM_XML_URI
]
=
"
\"
sip:alex@example.com
\"
"
;
sfl
::
InstantMessaging
::
UriEntry
entry
;
entry
[
sfl
::
IM_XML_URI
]
=
std
::
string
(
from
)
;
sfl
::
InstantMessaging
::
UriEntry
entry2
;
entry2
[
sfl
::
IM_XML_URI
]
=
"
\"
sip:manu@example.com
\"
"
;
list
.
push_front
(
&
entry1
);
list
.
push_front
(
&
entry2
);
list
.
push_front
(
&
entry
);
std
::
string
formatedMessage
=
imModule
->
appendUriList
(
message
,
list
);
...
...
@@ -3454,6 +3450,9 @@ void call_on_tsx_changed (pjsip_inv_session *inv UNUSED, pjsip_transaction *tsx,
// Incoming TEXT message
if
(
e
&&
e
->
body
.
tsx_state
.
src
.
rdata
)
{
// sender of this message
std
::
string
from
;
// Get the message inside the transaction
r_data
=
e
->
body
.
tsx_state
.
src
.
rdata
;
std
::
string
formatedMessage
=
(
char
*
)
r_data
->
msg_info
.
msg
->
body
->
data
;
...
...
@@ -3470,13 +3469,32 @@ void call_on_tsx_changed (pjsip_inv_session *inv UNUSED, pjsip_transaction *tsx,
pjsip_dlg_create_response
(
inv
->
dlg
,
r_data
,
PJSIP_SC_OK
,
NULL
,
&
t_data
);
pjsip_dlg_send_response
(
inv
->
dlg
,
tsx
,
t_data
);
// retrive message from formated text
std
::
string
message
=
imModule
->
findTextMessage
(
formatedMessage
);
// retreive the recipient-list of this message
std
::
string
urilist
=
imModule
->
findTextUriList
(
formatedMessage
);
// parse the recipient list xml
InstantMessaging
::
UriList
list
=
imModule
->
parseXmlUriList
(
formatedMessage
);
// If no item present in the list, peer is considered as the sender
if
(
list
.
empty
())
from
=
call
->
getPeerNumber
();
else
{
// InstaintMessaging::UriEntry *entry = static_cast<InstantMessaging::UriEntry *>(*iterItem);
// InstantMessaging::UriEntry::iterator iterAttr = entry->find(IM_XML_URI);
InstantMessaging
::
UriEntry
*
entry
=
list
.
front
();
InstantMessaging
::
UriEntry
::
iterator
iterAttr
=
entry
->
find
(
IM_XML_URI
);
from
=
iterAttr
->
second
;
}
// Pass through the instant messaging module if needed
// Right now, it does do anything.
// And notify the clients
Manager
::
instance
().
incomingMessage
(
call
->
getCallId
(),
call
->
getPeerNumber
(),
Manager
::
instance
().
incomingMessage
(
call
->
getCallId
(),
from
,
imModule
->
receive
(
message
,
call
->
getPeerNumber
(),
call
->
getCallId
()));
}
...
...
sflphone-common/src/sip/sipvoiplink.h
View file @
5e66024c
...
...
@@ -364,7 +364,17 @@ class SIPVoIPLink : public VoIPLink
*/
void
shutdownSipTransport
(
const
AccountID
&
accountID
);
bool
sendTextMessage
(
const
std
::
string
&
callID
,
const
std
::
string
&
message
);
/**
* Send a SIP message to a call identified by its callid
*
* @param The Id of the call to send the message to
* @param The actual message to be transmitted
* @param The sender of this message (could be another participant of a conference)
*
* @return True if the message is sent without error, false elsewhere
*/
bool
sendTextMessage
(
const
std
::
string
&
callID
,
const
std
::
string
&
message
,
const
std
::
string
&
from
);
private:
/**
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment