~ubuntu-branches/debian/stretch/sflphone/stretch

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.1.0/pjsip-apps/src/py_pjsua/pjsua.py

  • Committer: Package Import Robot
  • Author(s): Francois Marier, Francois Marier, Mark Purcell
  • Date: 2014-10-18 15:08:50 UTC
  • mfrom: (1.1.12)
  • Revision ID: package-import@ubuntu.com-20141018150850-2exfk34ckb15pcwi
Tags: 1.4.1-0.1
[ Francois Marier ]
* Non-maintainer upload
* New upstream release (closes: #759576, #741130)
  - debian/rules +PJPROJECT_VERSION := 2.2.1
  - add upstream patch to fix broken TLS support
  - add patch to fix pjproject regression

[ Mark Purcell ]
* Build-Depends:
  - sflphone-daemon + libavformat-dev, libavcodec-dev, libswscale-dev,
  libavdevice-dev, libavutil-dev
  - sflphone-gnome + libclutter-gtk-1.0-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
import py_pjsua
2
 
 
3
 
status = py_pjsua.create()
4
 
print "py status " + `status`
5
 
 
6
 
 
7
 
#
8
 
# Create configuration objects
9
 
#
10
 
ua_cfg = py_pjsua.config_default()
11
 
log_cfg = py_pjsua.logging_config_default()
12
 
media_cfg = py_pjsua.media_config_default()
13
 
 
14
 
#
15
 
# Logging callback.
16
 
#
17
 
def logging_cb1(level, str, len):
18
 
    print str,
19
 
 
20
 
 
21
 
#
22
 
# Configure logging
23
 
#
24
 
log_cfg.cb = logging_cb1
25
 
log_cfg.console_level = 4
26
 
 
27
 
#
28
 
# Initialize pjsua!
29
 
#
30
 
status = py_pjsua.init(ua_cfg, log_cfg, media_cfg);
31
 
print "py status after initialization :" + `status`
32
 
 
33
 
 
34
 
#
35
 
# Start pjsua!
36
 
#
37
 
status = py_pjsua.start()
38
 
if status != 0:
39
 
    exit(1)
40
 
 
41
 
 
42
 
message = py_pjsua.msg_data_init()
43
 
 
44
 
print "identitas object message data :" + `message`
45
 
 
46
 
sipaddr = 'sip:167.205.34.99'
47
 
print "checking sip address [%s] : %d" % (sipaddr, py_pjsua.verify_sip_url(sipaddr))
48
 
 
49
 
sipaddr = '167.205.34.99'
50
 
print "checking invalid sip address [%s] : %d" % (sipaddr, py_pjsua.verify_sip_url(sipaddr))
51
 
 
52
 
object = py_pjsua.get_pjsip_endpt()
53
 
print "identitas Endpoint :" + `object` + ""
54
 
 
55
 
mediaend = py_pjsua.get_pjmedia_endpt()
56
 
print "identitas Media Endpoint :" + `mediaend` + ""
57
 
 
58
 
pool = py_pjsua.get_pool_factory()
59
 
print "identitas pool factory :" + `pool` + ""
60
 
 
61
 
status = py_pjsua.handle_events(3000)
62
 
print "py status after 3 second of blocking wait :" + `status`
63
 
 
64
 
 
65
 
 
66
 
# end of new testrun
67
 
 
68
 
#
69
 
 
70
 
# lib transport
71
 
stunc = py_pjsua.stun_config_default();
72
 
 
73
 
 
74
 
tc = py_pjsua.transport_config_default();
75
 
 
76
 
 
77
 
py_pjsua.normalize_stun_config(stunc);
78
 
 
79
 
 
80
 
status, id = py_pjsua.transport_create(1, tc);
81
 
print "py transport create status " + `status`
82
 
 
83
 
ti = py_pjsua.Transport_Info();
84
 
ti = py_pjsua.transport_get_info(id)
85
 
print "py transport get info status " + `status`
86
 
 
87
 
status = py_pjsua.transport_set_enable(id,1)
88
 
print "py transport set enable status " + `status`
89
 
if status != 0 :
90
 
        py_pjsua.perror("py_pjsua","set enable",status)
91
 
 
92
 
 
93
 
status = py_pjsua.transport_close(id,1)
94
 
print "py transport close status " + `status`
95
 
if status != 0 :
96
 
        py_pjsua.perror("py_pjsua","close",status)
97
 
 
98
 
# end of lib transport
99
 
 
100
 
# lib account 
101
 
 
102
 
accfg = py_pjsua.acc_config_default()
103
 
status, accid = py_pjsua.acc_add(accfg, 1)
104
 
print "py acc add status " + `status`
105
 
if status != 0 :
106
 
        py_pjsua.perror("py_pjsua","add acc",status)
107
 
count = py_pjsua.acc_get_count()
108
 
print "acc count " + `count`
109
 
 
110
 
accid = py_pjsua.acc_get_default()
111
 
 
112
 
print "acc id default " + `accid`
113
 
 
114
 
# end of lib account
115
 
 
116
 
#lib buddy
117
 
 
118
 
bcfg = py_pjsua.Buddy_Config()
119
 
status, id = py_pjsua.buddy_add(bcfg)
120
 
acc_id = id
121
 
print "py buddy add status " + `status` + " id " + `id`
122
 
bool = py_pjsua.buddy_is_valid(id)
123
 
print "py buddy is valid " + `bool`
124
 
count = py_pjsua.get_buddy_count()
125
 
print "buddy count " + `count`
126
 
binfo = py_pjsua.buddy_get_info(id)
127
 
ids = py_pjsua.enum_buddies()
128
 
status = py_pjsua.buddy_del(id)
129
 
print "py buddy del status " + `status`
130
 
status = py_pjsua.buddy_subscribe_pres(id, 1)
131
 
print "py buddy subscribe pres status " + `status`
132
 
py_pjsua.pres_dump(1)
133
 
status = py_pjsua.im_send(accid, "fahris@divusi.com", "", "hallo", message, 0)
134
 
print "py im send status " + `status`
135
 
status = py_pjsua.im_typing(accid, "fahris@divusi.com", 1, message)
136
 
print "py im typing status " + `status`
137
 
#print "binfo " + `binfo`
138
 
 
139
 
#end of lib buddy
140
 
 
141
 
#lib media
142
 
count = py_pjsua.conf_get_max_ports()
143
 
print "py media conf get max ports " + `count`
144
 
count = py_pjsua.conf_get_active_ports()
145
 
print "py media conf get active ports " + `count`
146
 
ids = py_pjsua.enum_conf_ports()
147
 
for id in ids:
148
 
        print "py media conf ports " + `id`
149
 
        cp_info = py_pjsua.conf_get_port_info(id)
150
 
        print "port info name " + cp_info.name
151
 
pool = py_pjsua.PJ_Pool()
152
 
port = py_pjsua.PJMedia_Port()
153
 
status, id = py_pjsua.conf_add_port(pool,port)
154
 
print "py media conf add port status " + `status` + " id " + `id`
155
 
if status != 0 :
156
 
        py_pjsua.perror("py_pjsua","add port",status)
157
 
status = py_pjsua.conf_remove_port(id)
158
 
print "py media conf remove port status " + `status`
159
 
if status != 0 :
160
 
        py_pjsua.perror("py_pjsua","remove port",status)
161
 
status = py_pjsua.conf_connect(id, id)
162
 
print "py media conf connect status " + `status`
163
 
if status != 0 :
164
 
        py_pjsua.perror("py_pjsua","connect",status)
165
 
status = py_pjsua.conf_disconnect(id, id)
166
 
print "py media conf disconnect status " + `status`
167
 
if status != 0 :
168
 
        py_pjsua.perror("py_pjsua","disconnect",status)
169
 
status, id = py_pjsua.player_create("test.wav", 0)
170
 
print "py media player create status " + `status` + " id " + `id`
171
 
if status != 0 :
172
 
        py_pjsua.perror("py_pjsua","player create",status)
173
 
c_id = py_pjsua.player_get_conf_port(id)
174
 
print "py media player get conf port id " + `c_id`
175
 
status = py_pjsua.player_set_pos(id, 10)
176
 
if status != 0 :
177
 
        py_pjsua.perror("py_pjsua","player set pos",status)
178
 
status = py_pjsua.player_destroy(id)
179
 
if status != 0 :
180
 
        py_pjsua.perror("py_pjsua","player destroy",status)
181
 
status, id = py_pjsua.recorder_create("rec.wav", 0, "None", 1000, 0)
182
 
print "py media recorder create status " + `status` + " id " + `id`
183
 
if status != 0 :
184
 
        py_pjsua.perror("py_pjsua","recorder create",status)
185
 
status = py_pjsua.recorder_get_conf_port(id)
186
 
print "py media recorder get conf port status " + `status`
187
 
if status != 0 :
188
 
        py_pjsua.perror("py_pjsua","recorder get conf port",status)
189
 
status = py_pjsua.recorder_destroy(id)
190
 
print "py media recorder destroy status " + `status`
191
 
if status != 0 :
192
 
        py_pjsua.perror("py_pjsua","recorder destroy",status)
193
 
#cdev, pdev = py_pjsua.get_snd_dev()
194
 
#print "py media get snd dev capture dev " + `cdev` + " playback dev " + `pdev`
195
 
status = py_pjsua.set_snd_dev(0,1)
196
 
print "py media set snd dev status " + `status`
197
 
if status != 0 :
198
 
        py_pjsua.perror("py_pjsua","set snd dev",status)
199
 
status = py_pjsua.set_null_snd_dev()
200
 
print "py media set null snd dev status " + `status`
201
 
if status != 0 :
202
 
        py_pjsua.perror("py_pjsua","set null snd dev",status)
203
 
port = py_pjsua.set_no_snd_dev()
204
 
status = py_pjsua.set_ec(0,0)
205
 
print "py media set ec status " + `status`
206
 
if status != 0 :
207
 
        py_pjsua.perror("py_pjsua","set ec",status)
208
 
tail = py_pjsua.get_ec_tail()
209
 
print "py media get ec tail " + `tail`
210
 
infos = py_pjsua.enum_codecs()
211
 
for info in infos:
212
 
        print "py media enum codecs " + `info`
213
 
status = py_pjsua.codec_set_priority("coba", 0)
214
 
print "py media codec set priority " + `status`
215
 
if status != 0 :
216
 
        py_pjsua.perror("py_pjsua","codec set priority",status)
217
 
c_param = py_pjsua.codec_get_param("coba")
218
 
status = py_pjsua.codec_set_param("coba", c_param)
219
 
print "py media codec set param " + `status`
220
 
if status != 0 :
221
 
        py_pjsua.perror("py_pjsua","codec set param",status)
222
 
        
223
 
#end of lib media
224
 
 
225
 
#lib call
226
 
 
227
 
count = py_pjsua.call_get_max_count()
228
 
print "py call get max count " + `count`
229
 
count = py_pjsua.call_get_count()
230
 
print "py call get count " + `count`
231
 
ids = py_pjsua.enum_calls()
232
 
for id in ids:
233
 
        print "py enum calls id " + `id`
234
 
msg_data = py_pjsua.Msg_Data()
235
 
status, id = py_pjsua.call_make_call(-1, "sip:bulukucing1@iptel.org", 0, 0, msg_data)
236
 
print "py call make call " + `status` + " id " + `id`
237
 
if status != 0 :
238
 
        py_pjsua.perror("py_pjsua","call make call",status)
239
 
bool = py_pjsua.call_is_active(id)
240
 
print "py call is active " + `bool`
241
 
bool = py_pjsua.call_has_media(id)
242
 
print "py call has media " + `bool`
243
 
cp_id = py_pjsua.call_get_conf_port(id)
244
 
print "py call get conf port " + `cp_id`
245
 
info = py_pjsua.call_get_info(id)
246
 
if info != None :
247
 
        print "py info id " + `info.id`
248
 
status = py_pjsua.call_set_user_data(id, 0)
249
 
print "py call set user data status " + `status`
250
 
if status != 0 :
251
 
        py_pjsua.perror("py_pjsua","set user data",status)
252
 
user_data = py_pjsua.call_get_user_data(id)
253
 
print "py call get user data " + `user_data`
254
 
 
255
 
 
256
 
 
257
 
#end of lib call
258
 
 
259
 
py_pjsua.perror("saya","hallo",70006)
260
 
 
261
 
status = py_pjsua.destroy()
262
 
print "py status " + `status`
263
 
 
264