Ticket #1998 (new enhancement)

Opened 4 years ago

Last modified 9 months ago

Asterisk Phone Notification

Reported by: chmouel@… Owned by: asterix
Priority: low Milestone: Patches Welcome
Component: notifications Version:
Severity: minor Keywords: plugin, patch
Cc: michael@… Blocked By:
OS: All Blocking:

Description

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

Attachments

Change History

Changed 4 years ago by anonymous

  • keywords thangthafz added
  • milestone set to 0.5

Changed 4 years ago by asterix

is there a JEP about that ?

Changed 3 years ago by anonymous

  • os set to All

No xep, except the doc wrote by ignite realtime, and it seems it has not been proposed as a standard yet.

Changed 3 years ago by steve-e

Let us wait till there is one...

Changed 14 months ago by johnny

  • keywords plugin added

this would make a nice plugin

Changed 11 months ago by johnny

  • milestone set to Patches Welcome

Changed 11 months ago by johnny

  • keywords plugin, patch added; plugin removed

need to review this and turn it into a plugin

Changed 9 months ago by spigot

  • cc michael@… added

Add/Change #1998 (Asterisk Phone Notification)

Author


E-mail address and user name can be saved in the Preferences.


Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from asterix. Next status will be 'new'
Next status will be 'needinfo'
The owner will change from asterix to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.