def __init__(self, str address not None, object id=None, object version=None, str user not None="-", str net_type not None="IN", str address_type not None="IP4",
str name not None=" ", str info=None, SDPConnection connection=None, unsigned long start_time=0, unsigned long stop_time=0, list attributes=None, list media=None):
cdef unsigned int version_id = 2208988800UL
cdef pj_time_val tv
pj_gettimeofday(&tv)
version_id += tv.sec
self.address = address
self.id = id if id is not None else version_id
self.version = version if version is not None else version_id
self.user = user
self.net_type = net_type
self.address_type = address_type
self.name = name
self.info = info
self.connection = connection
self.start_time = start_time
self.stop_time = stop_time
self.attributes = attributes if attributes is not None else []
self.media = media if media is not None else []
+ @classmethod
+ def new(cls, BaseSDPSession sdp_session):
+ connection = SDPConnection.new(sdp_session.connection) if (sdp_session.connection is not None) else None
+ attributes = [SDPAttribute.new(attr) for attr in sdp_session.attributes]
+ media = [SDPMediaStream.new(m) for m in sdp_session.media]
def __init__(self, str address not None, object id=None, object version=None, str user not None="-", str net_type not None="IN", str address_type not None="IP4", str name not None=" ",
str info=None, FrozenSDPConnection connection=None, unsigned long start_time=0, unsigned long stop_time=0, frozenlist attributes not None=frozenlist(), frozenlist media not None=frozenlist()):
cdef unsigned int version_id = 2208988800UL
cdef pj_time_val tv
if not self.initialized:
if len(attributes) > PJMEDIA_MAX_SDP_ATTR:
raise SIPCoreError("Too many attributes")
for attr in attributes:
if not isinstance(attr, FrozenSDPAttribute):
raise TypeError("Items in FrozenSDPSession attribute list must be FrozenSDPAttribute instances")
if len(media) > PJMEDIA_MAX_SDP_MEDIA:
raise SIPCoreError("Too many media objects")
for m in media:
if not isinstance(m, FrozenSDPMediaStream):
raise TypeError("Items in FrozenSDPSession media list must be FrozenSDPMediaStream instancess")