115 | | For the rest of this tutorial, we will assume that you already have the IDE and target device (or simulator) configured for debugging BB10 application. If not, follow [https://developer.blackberry.com/native/documentation/bb10/com.qnx.doc.native_sdk.quickstart/topic/set_up_your_environment.html these instructions]. |
116 | | |
117 | | Assorted things to check before debugging an application to the device: |
| 111 | For the rest of this tutorial, we will assume that you already have the IDE and target device (or simulator) configured for debugging BB10 native applications. If not, follow [https://developer.blackberry.com/native/documentation/bb10/com.qnx.doc.native_sdk.quickstart/topic/set_up_your_environment.html these instructions] from !BlackBerry developer site. |
| 112 | |
| 113 | |
| 114 | [[BR]] |
| 115 | |
| 116 | == Building and Running the pjsua Demo Application == |
| 117 | |
| 118 | PJSIP comes with a fully featured pjsua application which runs on all platforms that PJSIP supports including BB10. |
| 119 | |
| 120 | === Import the PjsuaBB Project === |
| 121 | |
| 122 | In Momentics IDE: |
| 123 | 1. Select '''File''' --> '''Import..''' |
| 124 | 1. Select '''General''' and '''Existing Projects into Workspace''', and press '''Next >''' |
| 125 | 1. In ''Import..'' dialog: |
| 126 | - Select root directory: '''{{{$PJ_DIR/pjsip-apps/src/pjsua/bb10}}}''' |
| 127 | Once you select the directory, '''PjsuaBB''' will appear under ''Projects'' list in the dialog. Make sure it is selected (by default it is). Click '''Finish''' |
| 128 | |
| 129 | === Build PjsuaBB === |
| 130 | |
| 131 | Just build it. |
| 132 | |
| 133 | === Create Debug Configuration === |
| 134 | |
| 135 | 1. Highlight "PjsuaBB" from the Project Navigator, select '''Run''' --> '''Debug Configurations..''' from the main menu |
| 136 | 1. From the left list, right click '''!BlackBerry C/C++ Application''', and select '''New..''' |
| 137 | 1. New debug settings will appear with default values |
| 138 | 1. Go to '''Debugger''' tab and uncheck '''Stop on startup''' |
| 139 | 1. Press '''Apply''' |
| 140 | |
| 141 | === Running PjsuaBB === |
| 142 | |
| 143 | Launch debugging session for PjsuaBB. Wait until the app is loaded on the device. You will see telnet instructions on the device's screen. Telnet to this address to operate the application. |
| 144 | |
| 145 | |
| 146 | [[BR]] |
| 147 | |
| 148 | == Creating a New PJSIP Based Application == #newapp |
| 149 | |
| 150 | === Creating a !BlackBerry Native Application === #appconfig |
| 151 | |
| 152 | Use Momentics new project wizard to create a new !BlackBerry native application. This should be easy, and we will not explain it here. |
| 153 | |
| 154 | Configure the permissions by double-clicking ''bar-descriptor.xml'' file and select ''Application'' tab from the bottom of the page, and check these permissions: |
| 155 | - Internet |
| 156 | - Microphone |
| 157 | - Run When Backgrounded |
| 158 | |
| 159 | |
| 160 | === Integrating PJSIP into the App === #newappintegrate |
| 161 | |
| 162 | Integrating PJSIP settings into the app is very easy: |
| 163 | 1. Open the app's '''.pro''' file (e.g. {{{PjsipBB.pro}}} for PjsipBB app) |
| 164 | 1. Include '''pjsip.pri''' file in the relevant target section, e.g.: |
| 165 | {{{ |
| 166 | .. |
| 167 | device { |
| 168 | CONFIG(debug, debug|release) { |
| 169 | .. |
| 170 | include(../../../../pjsip.pri) |
| 171 | LIBS += -lbb |
| 172 | .. |
| 173 | } |
| 174 | } |
| 175 | .. |
| 176 | }}} |
| 177 | |
| 178 | The '''pjsip.pri''' file is generated by {{{configure-bb10}}} script (as explained [#pjsippri above]) and contains compilation and link flags to integrate PJSIP with your app. |
| 179 | |
| 180 | |
| 181 | [[BR]] |
| 182 | |
| 183 | == Simulator == |
| 184 | |
| 185 | Install and configure the BB10 simulator, you will need to install a virtual machine player in order to use the simulator. To build for BB10 simulator, just run {{{configure-bb10}}} script with {{{--simulator}}} option: |
| 186 | {{{ |
| 187 | $ ./configure-bb10 --simulator |
| 188 | }}} |
| 189 | |
| 190 | |
| 191 | [[BR]] |
| 192 | |
| 193 | == Multiple PJSIP Build Configurations == |
| 194 | |
| 195 | If you want to have multiple PJSIP build configurations for your app (for example, Device-Debug, Device-Release, and/or Simulator), you can use the following approach when building PJSIP. |
| 196 | |
| 197 | |
| 198 | === Option 1: Build PJSIP in Multiple Directories === |
| 199 | |
| 200 | This is of course the easiest, just extract or checkout PJSIP in multiple locations, configure it differently, build, and include the right '''pjsip.pri''' file in the relevant section of you application's QMake '''.pro''' file. |
| 201 | |
| 202 | === Option 2: Checkout Once, Configure Build and Install Several Times === |
| 203 | |
| 204 | The second option is to checkout PJSIP in one directory, but configure, build, and install it several times, each with separate build settings and to different install '''{{{--prefix}}}'''. Once the build completes, run {{{make install}}} to install PJSIP development headers and libraries to the installation prefix. You also need to edit the contents of {{{pjsip.pri}}} file, point the path to the right prefix, and rename the {{{pjsip.pri}}} to something more appropriate (e.g. {{{pjsip-device-debug.pri}}}). You then include this .pri file in the relevant section of your application's QMake {{{.pro}}} file. |
| 205 | |
| 206 | |
| 207 | |
| 208 | [[BR]] |
| 209 | |
| 210 | == Notes == |
| 211 | |
| 212 | === Missing Separator === |
| 213 | |
| 214 | If you forgot to run '''{{{source bbndk-env.sh}}}''' (as explained [#ndk above]) before running {{{make dep}}}, the dependency files will get corrupted with the ''' "!** missing separator" ''' error and you'll have to delete each of those dependency files manually. |
| 215 | |
| 216 | === GSM Call Interruption Problem === #gsm |
| 217 | |
| 218 | If a VoIP call is in progress when an incoming GSM call arrives, and if the user accepts the GSM call, the audio routing of the phone is flawed producing the following result: The VoIP call goes to speaker and the GSM call does not “grab” the audio channels so you get a “null” GSM call and the VoIP call carries on with speaker. |
| 219 | |
| 220 | To prevent this from happening, application must implement GSM call detection using BB10 native API, and when it detects a GSM call, it should close PJSIP sound device by using either {{{pjsua_set_null_snd_dev()}}} or {{{pjsua_set_no_snd_dev()}}} and put the VoIP call on hold before accepting the GSM call. |
| 221 | |
| 222 | Thank you Bob Cripps of Truphone for the note. |
| 223 | |
| 224 | === Unable to Get Sound Device Parameters === #snd0 |
| 225 | |
| 226 | This error happens because PJSIP is unable to open the audio capture device. Make sure you set the [#appconfig application permissions] correctly. |
| 227 | |
| 228 | === Troubleshooting !BlackBerry Target Device === #targetprob |
| 229 | |
128 | | |
129 | | |
130 | | [[BR]] |
131 | | |
132 | | == Building and Running the pjsua Demo Application == |
133 | | |
134 | | PJSIP comes with a fully featured pjsua application which runs on all platforms that PJSIP supports including BB10. |
135 | | |
136 | | === Import the PjsuaBB Project === |
137 | | |
138 | | In Momentics IDE: |
139 | | 1. Select '''File''' --> '''Import..''' |
140 | | 1. Select '''General''' and '''Existing Projects into Workspace''', and press '''Next >''' |
141 | | 1. In ''Import..'' dialog: |
142 | | - Select root directory: '''{{{$PJ_DIR/pjsip-apps/src/pjsua/bb10}}}''' |
143 | | Once you select the directory, '''PjsuaBB''' will appear under ''Projects'' list in the dialog. Make sure it is selected (by default it is). Click '''Finish''' |
144 | | |
145 | | === Build PjsuaBB === |
146 | | |
147 | | Just build it. |
148 | | |
149 | | === Create Debug Configuration === |
150 | | |
151 | | 1. Highlight "PjsuaBB" from the Project Navigator, select '''Run''' --> '''Debug Configurations..''' from the main menu |
152 | | 1. From the left list, right click '''!BlackBerry C/C++ Application''', and select '''New..''' |
153 | | 1. New debug settings will appear with default values |
154 | | 1. Go to '''Debugger''' tab and uncheck '''Stop on startup''' |
155 | | 1. Press '''Apply''' |
156 | | |
157 | | |
158 | | [[BR]] |
159 | | |
160 | | == Creating a New PJSIP Based Application == #newapp |
161 | | |
162 | | === Creating a !BlackBerry Native Application === #appconfig |
163 | | |
164 | | Use Momentics new project wizard to create a new !BlackBerry native application. This should be easy, and we will not explain it here. |
165 | | |
166 | | Configure the permissions by double-clicking ''bar-descriptor.xml'' file and select ''Application'' tab from the bottom of the page, and check these permissions: |
167 | | - Internet |
168 | | - Microphone |
169 | | - Run When Backgrounded |
170 | | |
171 | | |
172 | | === Integrating PJSIP into the App === #newappintegrate |
173 | | |
174 | | Integrating PJSIP settings into the app is very easy: |
175 | | 1. Open the app's '''.pro''' file (e.g. {{{PjsipBB.pro}}} for PjsipBB app) |
176 | | 1. Include '''pjsip.pri''' file in the relevant target section, e.g.: |
177 | | {{{ |
178 | | .. |
179 | | device { |
180 | | CONFIG(debug, debug|release) { |
181 | | .. |
182 | | include(../../../../pjsip.pri) |
183 | | LIBS += -lbb |
184 | | .. |
185 | | } |
186 | | } |
187 | | .. |
188 | | }}} |
189 | | |
190 | | The '''pjsip.pri''' file is generated by {{{configure-bb10}}} script (as explained [#pjsippri above]) and contains compilation and link flags to integrate PJSIP with your app. |
191 | | |
192 | | |
193 | | [[BR]] |
194 | | |
195 | | == Simulator == |
196 | | |
197 | | Install and configure the BB10 simulator, you will need to install a virtual machine player in order to use the simulator. To build for BB10 simulator, just run {{{configure-bb10}}} script with {{{--simulator}}} option: |
198 | | {{{ |
199 | | $ ./configure-bb10 --simulator |
200 | | }}} |
201 | | |
202 | | |
203 | | [[BR]] |
204 | | |
205 | | == Multiple PJSIP Build Configurations == |
206 | | |
207 | | If you want to have multiple PJSIP build configurations for your app (for example, Device-Debug, Device-Release, and/or Simulator), you can use the following approach when building PJSIP. |
208 | | |
209 | | |
210 | | === Option 1: Build PJSIP in Multiple Directories === |
211 | | |
212 | | This is of course the easiest, just extract or checkout PJSIP in multiple locations, configure it differently, build, and include the right '''pjsip.pri''' file in the relevant section of you application's QMake '''.pro''' file. |
213 | | |
214 | | === Option 2: Checkout Once, Configure Build and Install Several Times === |
215 | | |
216 | | The second option is to checkout PJSIP in one directory, but configure, build, and install it several times, each with separate build settings and to different install '''{{{--prefix}}}'''. Once the build completes, run {{{make install}}} to install PJSIP development headers and libraries to the installation prefix. You also need to edit the contents of {{{pjsip.pri}}} file, point the path to the right prefix, and rename the {{{pjsip.pri}}} to something more appropriate (e.g. {{{pjsip-device-debug.pri}}}). You then include this .pri file in the relevant section of your application's QMake {{{.pro}}} file. |
217 | | |
218 | | |
219 | | |
220 | | [[BR]] |
221 | | |
222 | | == Notes == |
223 | | |
224 | | === Missing Separator === |
225 | | |
226 | | If you forgot to run '''{{{source bbndk-env.sh}}}''' (as explained [#ndk above]) before running {{{make dep}}}, the dependency files will get corrupted with the ''' "!** missing separator" ''' error and you'll have to delete each of those dependency files manually. |
227 | | |
228 | | === GSM Call Interruption Problem === #gsm |
229 | | |
230 | | If a VoIP call is in progress when an incoming GSM call arrives, and if the user accepts the GSM call, the audio routing of the phone is flawed producing the following result: The VoIP call goes to speaker and the GSM call does not “grab” the audio channels so you get a “null” GSM call and the VoIP call carries on with speaker. |
231 | | |
232 | | To prevent this from happening, application must implement GSM call detection using BB10 native API, and when it detects a GSM call, it should close PJSIP sound device by using either {{{pjsua_set_null_snd_dev()}}} or {{{pjsua_set_no_snd_dev()}}} and put the VoIP call on hold before accepting the GSM call. |
233 | | |
234 | | Thank you Bob Cripps of Truphone for the note. |
235 | | |
236 | | === Unable to Get Sound Device Parameters === #snd0 |
237 | | |
238 | | This error happens because PJSIP is unable to open the audio capture device. Make sure you set the [#appconfig application permissions] correctly. |
239 | | |