Skip to content

Notify Event not available #2

Closed

Description

@Djcd

When i try to use your example from http://sipjs.com/api/0.5.0/subscription/#events

i get

sip.ua | unable to add a listener to a nonexistent event notify sip-0.5.0.js:168
TypeError: Invalid or uninitialized event: notify
    at Object.EventEmitter.on (http://localhost:8080/js/sip-0.5.0.js:321:13)
    at new homeController (http://localhost:8080/app/controllers/homeController.js:6:19)

Greetings
Djcd

Activity

  1. josephfrazier commented on Apr 28, 2014

    @josephfrazier
    Contributor

    Hi Djcd,

    I think the example code block shown at http://sipjs.com/api/0.5.0/subscription/#examples was incorrect. Please try this instead:

    //Subscribes to the presence information of [email protected]
    var subscription = myUA.subscribe('[email protected]', 'presence');
    
    // Once subscribed, receive notifications and print out the presence information
    subscription.on('notify', function (notification) {
      console.log(notification.body);
    });

    Let us know how it goes!

    Joseph

  2. Djcd commented on Apr 29, 2014

    @Djcd
    Author

    Hi Joseph,

    Thanks for the fast reply! That new example makes more sense and it works just fine:

    //Subscribes to the presence information of [email protected]
    var subscription = userAgent.subscribe('[email protected]', 'presence');
    
    // Once subscribed, receive notifications and print out the presence information
    subscription.on('notify', function (notification) {
        console.log(notification.request.body);
    });

    Thx again,
    Djcd

  3. josephfrazier commented on Apr 29, 2014

    @josephfrazier
    Contributor

    I'm glad to hear you got it working! I'll update the example code accordingly. Please feel free to ask about any other issues you run into.

    Joseph

  4. Djcd commented on Apr 29, 2014

    @Djcd
    Author

    That should be the correct example for everyone

  5. umasgn commented on Dec 8, 2016

    @umasgn

    What if i want to subscribe for multiple uri
    code
    ?

  6. added a commit that references this issue on Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions