Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

added JabberEvent, added ScreenName to JabberAction

  • Loading branch information...
commit ce882eb5f0088c4e53ceccf4e860cf1936489ecc 1 parent dc9fae4
Marcelo Gornstein authored July 17, 2012
49  README
@@ -17,12 +17,12 @@ either via SOA or ajax.
17 17
 
18 18
 You may want to take a look at Ding https://github.com/marcelog/Ding if you're
19 19
 interested in using DI, AOP, and other stuff in your telephony applications.
20  
---------------------------------------------------------------------------------
  20
+-------------------------------------------------------------------------------
21 21
 CI Server
22 22
 ---------
23  
-Take a look at the Jenkins CI Server (http://ci.marcelog.name/) to check out the
24  
-docs, metrics, and pear and phar packages available.
25  
---------------------------------------------------------------------------------
  23
+Take a look at the Jenkins CI Server (http://ci.marcelog.name/) to check out
  24
+the docs, metrics, and pear and phar packages available.
  25
+-------------------------------------------------------------------------------
26 26
 Available via PEAR
27 27
 ------------------
28 28
 You can now easily install PAMI by issuing:
@@ -34,19 +34,20 @@ or
34 34
 # pear install marcelog/PAMI-1.62.0
35 35
 just replace 1.62.0 by the release version you'd like to install :)
36 36
 See: http://pear.marcelog.name/
37  
---------------------------------------------------------------------------------
  37
+-------------------------------------------------------------------------------
38 38
 Asterisk versions supported
39 39
 ===========================
40  
-PAMI is tested in asterisk 1.6, 1.4, and 1.8 versions, just because this are the
41  
-versions I use in my boxes. If you need support for other versions, please
  40
+PAMI is tested in asterisk 1.6, 1.4, and 1.8 versions, just because this are
  41
+the versions I use in my boxes. If you need support for other versions, please
42 42
 contact me.
43  
---------------------------------------------------------------------------------
  43
+-------------------------------------------------------------------------------
44 44
 QuickStart
45 45
 ==========
46 46
 For an in-depth tutorial: http://marcelog.github.com/articles/pami_introduction_tutorial_how_to_install.html
47 47
 
48 48
 $options = array(
49  
-    'log4php.properties' => RESOURCES_DIR . DIRECTORY_SEPARATOR . 'log4php.properties',
  49
+    'log4php.properties' =>
  50
+         RESOURCES_DIR . DIRECTORY_SEPARATOR . 'log4php.properties',
50 51
     'host' => '2.3.4.5',
51 52
     'scheme' => 'tcp://',
52 53
     'port' => 9999,
@@ -66,12 +67,12 @@ $client->registerEventListener(array($listener, 'handle'));
66 67
 
67 68
 // Register an IEventListener:
68 69
 $client->registerEventListener($listener);
69  
---------------------------------------------------------------------------------
  70
+-------------------------------------------------------------------------------
70 71
 Using Predicates
71 72
 ================
72 73
 A second (optional) argument can be used when registering the event listener: a
73  
-closure that will be evaluated before calling the callback. The callback will be
74  
-called only if this predicate returns true:
  74
+closure that will be evaluated before calling the callback. The callback will 
  75
+be called only if this predicate returns true:
75 76
 
76 77
 use PAMI\Message\Event\DialEvent;
77 78
 
@@ -81,7 +82,7 @@ $client->registerEventListener(
81 82
         return $event instanceof DialEvent && $event->getSubEvent() == 'Begin';
82 83
     })
83 84
 );
84  
---------------------------------------------------------------------------------
  85
+-------------------------------------------------------------------------------
85 86
 Example
86 87
 =======
87 88
 Please see docs/examples/quickstart/example.php for a very basic example.
@@ -91,7 +92,7 @@ AsterTrace is a full application: https://github.com/marcelog/AsterTrace.
91 92
 Also, you might want to look at this article: http://marcelog.github.com/articles/php_asterisk_listener_example_using_pami_and_ding.html
92 93
 
93 94
 For an example of using asynchronous AGI with PAMI, see docs/examples/asyncagi
94  
---------------------------------------------------------------------------------
  95
+-------------------------------------------------------------------------------
95 96
 Currently Supported Events
96 97
 ==========================
97 98
 More events will be added with time. I can only add the ones I can test for and
@@ -128,6 +129,7 @@ can still catch them. If you catch one of these, please report it!
128 129
 * Extension
129 130
 * Hangup
130 131
 * Hold
  132
+* JabberEvent
131 133
 * Join
132 134
 * Leave
133 135
 * ListDialplan
@@ -170,7 +172,7 @@ can still catch them. If you catch one of these, please report it!
170 172
 * vgsm_sms_rx
171 173
 * VoicemailUserEntry
172 174
 * VoicemailUserEntryComplete
173  
---------------------------------------------------------------------------------
  175
+-------------------------------------------------------------------------------
174 176
 Currently Supported Actions
175 177
 ===========================
176 178
 * AbsoluteTimeout
@@ -256,7 +258,7 @@ Currently Supported Actions
256 258
 * UnpauseMonitor
257 259
 * VGSM_SMS_TX
258 260
 * VoicemailUsersList
259  
---------------------------------------------------------------------------------
  261
+-------------------------------------------------------------------------------
260 262
 Developers
261 263
 ==========
262 264
 * build.xml is a phing build file, not ant.
@@ -268,13 +270,13 @@ Developers
268 270
 to run ding tests and metrics.
269 271
 * Run phing all
270 272
 * Check the API at http://marcelog.github.com/PAMI/api.html
271  
---------------------------------------------------------------------------------
  273
+-------------------------------------------------------------------------------
272 274
 Debugging, logging
273 275
 ==================
274 276
 
275 277
 You need log4php (http://logging.apache.org/log4php/). Just make sure you copy
276 278
 it to the include_path and PAMI will pick it up from there.
277  
---------------------------------------------------------------------------------
  279
+-------------------------------------------------------------------------------
278 280
 LICENSE
279 281
 =======
280 282
 Copyright 2011 Marcelo Gornstein <marcelog@gmail.com>
@@ -290,7 +292,7 @@ distributed under the License is distributed on an "AS IS" BASIS,
290 292
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
291 293
 See the License for the specific language governing permissions and
292 294
 limitations under the License.
293  
---------------------------------------------------------------------------------
  295
+-------------------------------------------------------------------------------
294 296
 Thanks To
295 297
 =========
296 298
 * Jason Blank <rumpled at github> for helping in the debugging of the queue
@@ -302,14 +304,17 @@ functionality and some other ami inconsistencies.
302 304
 
303 305
 * Eli Hunter, for helping in bringing in tls compatibility.
304 306
 
305  
-* Freddy dafredmail at googlemail, for his help and testing environment to add dongle support.
  307
+* Freddy dafredmail at googlemail, for his help and testing environment to add
  308
+dongle support.
306 309
 
307 310
 * Joshua Elson for his help in trying and debugging in loaded asterisk servers.
308 311
 
309  
-* Jacob Kiers for his help in bringing in and testing async agi functionality, and CEL event
  312
+* Jacob Kiers for his help in bringing in and testing async agi functionality,
  313
+and CEL event
310 314
 support.
311 315
 
312  
-* Richard Baar for noticing the lack of eof support when reading from socket.
  316
+* Richard Baar for noticing the lack of eof support when reading from socket,
  317
+the JabberEvent, and the ScreenName in JabberAction.
313 318
 
314 319
 * Scot Opell for helping in debugging stream_get_line() in 5.3.9 and 5.3.10
315 320
 
1  src/mg/PAMI/Message/Action/JabberSendAction.php
@@ -57,6 +57,7 @@ public function __construct($jabber, $jid, $message)
57 57
         parent::__construct('JabberSend');
58 58
         $this->setKey('Jabber', $jabber);
59 59
         $this->setKey('JID', $jid);
  60
+        $this->setKey('ScreenName', $jid);
60 61
         $this->setKey('Message', $message);
61 62
     }
62 63
 }
78  src/mg/PAMI/Message/Event/JabberEventEvent.php
... ...
@@ -0,0 +1,78 @@
  1
+<?php
  2
+/**
  3
+ * Event triggered for Jabber Activity. A contribution from
  4
+ * Richard Baar.
  5
+ *
  6
+ * PHP Version 5
  7
+ *
  8
+ * @category   Pami
  9
+ * @package    Message
  10
+ * @subpackage Action
  11
+ * @author     Marcelo Gornstein <marcelog@gmail.com>
  12
+ * @license    http://marcelog.github.com/PAMI/ Apache License 2.0
  13
+ * @version    SVN: $Id$
  14
+ * @link       http://marcelog.github.com/PAMI/
  15
+ *
  16
+ * Copyright 2011 Marcelo Gornstein <marcelog@gmail.com>
  17
+ *
  18
+ * Licensed under the Apache License, Version 2.0 (the "License");
  19
+ * you may not use this file except in compliance with the License.
  20
+ * You may obtain a copy of the License at
  21
+ *
  22
+ *     http://www.apache.org/licenses/LICENSE-2.0
  23
+ *
  24
+ * Unless required by applicable law or agreed to in writing, software
  25
+ * distributed under the License is distributed on an "AS IS" BASIS,
  26
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  27
+ * See the License for the specific language governing permissions and
  28
+ * limitations under the License.
  29
+ *
  30
+ */
  31
+namespace PAMI\Message\Event;
  32
+
  33
+use PAMI\Message\Event\EventMessage;
  34
+
  35
+/**
  36
+ * Event Jabber 
  37
+ *
  38
+ * PHP Version 5
  39
+ *
  40
+ * @category   Pami
  41
+ * @package    Message
  42
+ * @subpackage Event
  43
+ * @author     Michal Hajek <michal.hajek@daktela.com>
  44
+ * @license    http://marcelog.github.com/PAMI/ Apache License 2.0
  45
+ * @link       http://marcelog.github.com/PAMI/
  46
+ */
  47
+class JabberEventEvent extends EventMessage
  48
+{
  49
+    /**
  50
+     * Returns key: 'Privilege'.
  51
+     *
  52
+     * @return string
  53
+     */
  54
+    public function getPrivilege()
  55
+    {
  56
+        return $this->getKey('Privilege');
  57
+    }
  58
+
  59
+    /**
  60
+     * Returns key: 'Account'.
  61
+     *
  62
+     * @return string
  63
+     */
  64
+    public function getAccount()
  65
+    {
  66
+        return $this->getKey('Account');
  67
+    }
  68
+
  69
+    /**
  70
+     * Returns key: 'Packet'.
  71
+     *
  72
+     * @return string
  73
+     */
  74
+    public function getPacket()
  75
+    {
  76
+        return $this->getKey('Packet');
  77
+    }
  78
+}
1  test/actions/Test_Actions.php
@@ -627,6 +627,7 @@ public function can_jabbersend()
627 627
             'actionid: 1432.123',
628 628
         	'jabber: jabber',
629 629
         	'jid: jid',
  630
+            'screenname: jid',
630 631
             'message: message',
631 632
             ''
632 633
         )));
7  test/events/Test_Events.php
@@ -73,7 +73,7 @@ public function can_report_events()
73 73
             'Agents', 'AgentsComplete', 'Agentlogoff', 'Agentlogin', 'AgentConnect',
74 74
             'DongleSMSStatus', 'FullyBooted', 'DongleShowDevicesComplete', 'DongleDeviceEntry',
75 75
             'DongleNewUSSDBase64', 'DongleNewUSSD', 'DongleUSSDStatus', 'DongleNewCUSD',
76  
-            'DongleStatus', 'CEL'
  76
+            'DongleStatus', 'CEL', 'JabberEvent'
77 77
         );
78 78
         $eventTranslatedValues = array(
79 79
             'QueueMemberStatus' => array(
@@ -90,6 +90,11 @@ public function can_report_events()
90 90
             ),
91 91
         );
92 92
         $eventValues = array(
  93
+            'JabberEvent' => array(
  94
+                'Privilege' => 'Privilege',
  95
+                'Account' => 'Account',
  96
+                'Packet' => 'Packet'
  97
+            ),
93 98
             'AsyncAGI' => array(
94 99
                 'Env' => 'Env',
95 100
                 'Channel' => 'Channel',

0 notes on commit ce882eb

Please sign in to comment.
Something went wrong with that request. Please try again.