Asterisk Phone Notification
Simple patch to have phone notification as defined by http://svn.jivesoftware.org/svn/repos/asterisk-im/trunk/documentation/phone_jep.html
i guess it could be improved but it does the job for me :
Index: src/gajim.py
===================================================================
--- src/gajim.py
+++ src/gajim.py
@@ -984,6 +984,15 @@
notify.popup(event_type, jid, account, 'file-send-error', path,
event_type, file_props['name'])
+ def handle_event_phone_notify(self, account, array):
+ jid = array[0]
+ title = "Phone Call"
+ text = "From: %s\nNumber: %s" % (array[2], array[1])
+ img = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events',
+ 'phone.png') #FIXME: find a better image
+ path = gtkgui_helpers.get_path_to_generic_or_avatar(img)
+ notify.popup(_('New Phone'), jid, account, 'phone', path_to_image = path, title = title, text = text)
+
def handle_event_gmail_notify(self, account, array):
jid = array[0]
gmail_new_messages = int(array[1])
@@ -1585,6 +1594,7 @@
'VCARD_PUBLISHED': self.handle_event_vcard_published,
'VCARD_NOT_PUBLISHED': self.handle_event_vcard_not_published,
'ASK_NEW_NICK': self.handle_event_ask_new_nick,
+ 'PHONE_NOTIFY': self.handle_event_phone_notify,
'SIGNED_IN': self.handle_event_signed_in,
'METACONTACTS': self.handle_event_metacontacts,
}
Index: src/common/connection_handlers.py
===================================================================
--- src/common/connection_handlers.py
+++ src/common/connection_handlers.py
@@ -1260,6 +1260,13 @@
chatstate = None
encTag = msg.getTag('x', namespace = common.xmpp.NS_ENCRYPTED)
decmsg = ''
+
+ if msg.getTagAttr('phone-event', 'type') == 'RING':
+ phone_event_caller_id = msg.getTag('phone-event').getTag('callerID').data[0]
+ phone_event_caller_name = msg.getTag('phone-event').getTag('callerIDName').data[0]
+ self.dispatch('PHONE_NOTIFY', (jid, phone_event_caller_id, phone_event_caller_name))
+ return
+
# invitations
invite = None
if not encTag:
needs to have phone.png in data/pixmaps/events which i did like this on my gnome based linux system :
cp /usr/share/icons/gnome/48x48/stock/generic/stock_landline-phone.png data/pixmaps/events/phone.png