Ignore:
Timestamp:
Jul 18, 2008 11:00:56 PM (16 years ago)
Author:
bennylp
Message:

Implemented ticket #192 for Python: Add callback to notify application about incoming SUBSCRIBE request, and add subscription state and termination reason in buddy info

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/python/_pjsua.h

    r2119 r2156  
    508508    PyObject * on_call_replaced; 
    509509    PyObject * on_reg_state; 
     510    PyObject * on_incoming_subscribe; 
    510511    PyObject * on_buddy_state; 
    511512    PyObject * on_pager; 
     
    530531    Py_XDECREF(self->on_call_replaced); 
    531532    Py_XDECREF(self->on_reg_state); 
     533    Py_XDECREF(self->on_incoming_subscribe); 
    532534    Py_XDECREF(self->on_buddy_state); 
    533535    Py_XDECREF(self->on_pager); 
     
    617619            return NULL; 
    618620        } 
     621        Py_INCREF(Py_None); 
     622        self->on_incoming_subscribe = Py_None; 
    619623        Py_INCREF(Py_None); 
    620624        self->on_buddy_state = Py_None; 
     
    718722        "Notify application when registration status has changed. Application " 
    719723        "may then query the account info to get the registration details." 
     724    }, 
     725    { 
     726        "on_incoming_subscribe", T_OBJECT_EX, 
     727        offsetof(PyObj_pjsua_callback, on_incoming_subscribe), 0, 
     728        "Notification when incoming SUBSCRIBE request is received." 
    720729    }, 
    721730    { 
     
    27692778    int          monitor_pres; 
    27702779    int          activity; 
     2780    int          sub_state; 
     2781    PyObject    *sub_term_reason; 
    27712782} PyObj_pjsua_buddy_info; 
    27722783 
     
    27822793    Py_XDECREF(self->contact); 
    27832794    Py_XDECREF(self->status_text); 
     2795    Py_XDECREF(self->sub_term_reason); 
    27842796     
    27852797    self->ob_type->tp_free((PyObject*)self); 
     
    28012813    obj->monitor_pres = info->monitor_pres; 
    28022814    obj->activity = info->rpid.activity; 
     2815    obj->sub_state = info->sub_state; 
     2816    Py_XDECREF(obj->sub_term_reason); 
     2817    obj->sub_term_reason = PyString_FromStringAndSize(info->sub_term_reason.ptr,  
     2818                                                      info->sub_term_reason.slen); 
    28032819} 
    28042820 
     
    28242840            Py_DECREF(self); 
    28252841            return NULL; 
    2826         }         
     2842        } 
    28272843        self->contact = PyString_FromString(""); 
    28282844        if (self->contact == NULL) { 
     
    28352851            return NULL; 
    28362852        } 
    2837          
     2853        self->sub_term_reason = PyString_FromString(""); 
    28382854    } 
    28392855    return (PyObject *)self; 
     
    28822898        offsetof(PyObj_pjsua_buddy_info, activity), 0, 
    28832899        "Activity type. " 
     2900    }, 
     2901    { 
     2902        "sub_state", T_INT,  
     2903        offsetof(PyObj_pjsua_buddy_info, sub_state), 0, 
     2904        "Subscription state." 
     2905    }, 
     2906    { 
     2907        "sub_term_reason", T_INT,  
     2908        offsetof(PyObj_pjsua_buddy_info, sub_term_reason), 0, 
     2909        "Subscription termination reason." 
    28842910    }, 
    28852911     
Note: See TracChangeset for help on using the changeset viewer.