1 <?xml version="1.0" encoding="UTF-8"?>
3 <sect1 id="zend.service.developergarden">
4 <title>Zend_Service_DeveloperGarden</title>
6 <sect2 id="zend.service.developergarden.introduction">
7 <title>Introduction to DeveloperGarden</title>
10 Developer Garden is the name of Deutsche Telekom’s developer community.
11 Developer Garden offers you access to core services of Deutsche Telekom,
12 such as voice connections (Voice Call) or sending text messages (Send SMS)
13 via open interfaces (Open <acronym>API</acronym>s). You can access the Developer Garden
14 services directly via <acronym>SOAP</acronym> or <acronym>REST</acronym>.
18 The family of <classname>Zend_Service_DeveloperGarden</classname> components provides a
19 clean and simple interface to the <ulink
20 url="http://www.developergarden.com">Developer Garden APIs</ulink> and additionally
21 offers functionality to improve handling and performance.
28 linkend="zend.service.developergarden.baseuserservice">BaseUserService</link>:
29 Class to manage <acronym>API</acronym> quota and user accounting details.
35 <link linkend="zend.service.developergarden.iplocation">IPLocation</link>:
36 Locale the given IP and returns geo coordinates. Works only with IPs allocated
37 in the network of the Deutsche Telekom.
43 <link linkend="zend.service.developergarden.localsearch">LocalSearch</link>:
44 Allows you to search with options nearby or around a given geo coordinate or
51 <link linkend="zend.service.developergarden.sendsms">SendSMS</link>: Send a SMS
52 or Flash SMS to a given number.
58 <link linkend="zend.service.developergarden.smsvalidation">SMSValidation</link>:
59 You can validate a number to use it with SendSMS for also supply a back channel.
65 <link linkend="zend.service.developergarden.voicecall">VoiceCall</link>:
66 Initiates a call between two participants.
73 linkend="zend.service.developergarden.conferencecall">ConferenceCall</link>:
74 You can configure a whole conference room with participants for an adhoc
75 conference or you can also schedule your conference.
81 The backend <acronym>SOAP</acronym> <acronym>API</acronym> is documented
82 <ulink url="http://www.developergarden.com/openapi/dokumentation/">here</ulink>.
85 <sect3 id="zend.service.developergarden.account">
86 <title>Sign Up for an Account</title>
89 Before you can start using the DeveloperGarden <acronym>API</acronym>, you first
90 have to <ulink url="http://www.developergarden.com/register">sign up</ulink> for an
95 <sect3 id="zend.service.developergarden.environment">
96 <title>The Environment</title>
99 With the DeveloperGarden <acronym>API</acronym> you have the possibility to choose
100 between 3 different development environments.
106 <emphasis>production</emphasis>: In Production environment there are no
107 usage limitations. You have to pay for calls, sms and other services with
114 <emphasis>sandbox</emphasis>: In the Sandbox mode you can use the same
115 features (with limitations) as in the production without to paying
116 for them. This environment is suitable for testing your prototype.
122 <emphasis>mock</emphasis>: The Mock environment allows you to build your
123 application and have results but you do not initiate any action on the
124 <acronym>API</acronym> side. This environment is intended for testing during
131 For every environment and service, there are some special features (options)
132 available for testing. Please look <ulink
133 url="http://www.developergarden.com/openapi/dokumentation/">here</ulink> for
138 <sect3 id="zend.service.developergarden.config">
139 <title>Your configuration</title>
142 You can pass to all classes an array of configuration values. Possible values are:
148 <emphasis>username</emphasis>: Your DeveloperGarden <acronym>API</acronym>
155 <emphasis>password</emphasis>: Your DeveloperGarden <acronym>API</acronym>
162 <emphasis>environment</emphasis>: The environment that you selected.
167 <example id="zend.service.developergarden.config.example">
168 <title>Configuration Example</title>
170 <programlisting language="php"><![CDATA[
171 require_once 'Zend/Service/DeveloperGarden/SendSms.php';
173 'username' => 'yourUsername',
174 'password' => 'yourPassword',
175 'environment' => Zend_Service_DeveloperGarden_SendSms::ENV_PRODUCTION,
177 $service = new Zend_Service_DeveloperGarden_SendSms($config);
183 <sect2 id="zend.service.developergarden.baseuserservice">
184 <title>BaseUserService</title>
187 The class can be used to set and get quota values for the services and to fetch
192 The <methodname>getAccountBalance()</methodname> method fetches an array
193 of account id's with the current balance status (credits).
196 <example id="zend.service.developergarden.baseuserservice.getaccountbalance.example">
197 <title>Get account balance example</title>
199 <programlisting language="php"><![CDATA[
200 $service = new Zend_Service_DeveloperGarden_BaseUserService($config);
201 print_r($service->getAccountBalance());
205 <sect3 id="zend.service.developergarden.baseuserservice.getquotainformation">
206 <title>Get quota information</title>
209 You can fetch quota informations for a specific service module with the
213 <example id="zend.service.developergarden.baseuserservice.getquotainformation.example">
214 <title>Get quota information example</title>
216 <programlisting language="php"><![CDATA[
217 $service = new Zend_Service_DeveloperGarden_BaseUserService($config);
218 $result = $service->getSmsQuotaInformation(
219 Zend_Service_DeveloperGarden_BaseUserService::ENV_PRODUCTION
221 echo 'Sms Quota:<br />';
222 echo 'Max Quota: ', $result->getMaxQuota(), '<br />';
223 echo 'Max User Quota: ', $result->getMaxUserQuota(), '<br />';
224 echo 'Quota Level: ', $result->getQuotaLevel(), '<br />';
229 You get a <classname>result</classname> object that contains all the information
230 you need, optional you can pass to the <methodname>QuotaInformation</methodname>
231 method the environment constant to fetch the quota for the specific environment.
235 Here a list of all <methodname>getQuotaInformation</methodname> methods:
241 <methodname>getConfernceCallQuotaInformation()</methodname>
247 <methodname>getIPLocationQuotaInformation()</methodname>
253 <methodname>getLocalSearchQuotaInformation()</methodname>
259 <methodname>getSmsQuotaInformation()</methodname>
265 <methodname>getVoiceCallQuotaInformation()</methodname>
271 <sect3 id="zend.service.developergarden.baseuserservice.changequotainformation">
272 <title>Change quota information</title>
275 To change the current quota use one of the <methodname>changeQuotaPool</methodname>
276 methods. First parameter is the new pool value and the second one is the
281 id="zend.service.developergarden.baseuserservice.changequotainformation.example">
282 <title>Change quota information example</title>
284 <programlisting language="php"><![CDATA[
285 $service = new Zend_Service_DeveloperGarden_BaseUserService($config);
286 $result = $service->changeSmsQuotaPool(
288 Zend_Service_DeveloperGarden_BaseUserService::ENV_PRODUCTION
290 if (!$result->hasError()) {
291 echo 'updated Quota Pool';
297 Here a list of all <methodname>changeQuotaPool</methodname> methods:
303 <methodname>changeConferenceCallQuotaPool()</methodname>
309 <methodname>changeIPLocationQuotaPool()</methodname>
315 <methodname>changeLocalSearchQuotaPool()</methodname>
321 <methodname>changeSmsQuotaPool()</methodname>
327 <methodname>changeVoiceCallQuotaPool()</methodname>
334 <sect2 id="zend.service.developergarden.iplocation">
335 <title>IP Location</title>
338 This service allows you to retrieve location information for a given IP address.
342 There are some limitations:
347 <para>The IP address must be in the T-Home network</para>
351 <para>Just the next big city will be resolved</para>
355 <para>IPv6 is not supported yet</para>
359 <example id="zend.service.developergarden.iplocation.locateip.example">
360 <title>Locate a given IP</title>
362 <programlisting language="php"><![CDATA[
363 $service = new Zend_Service_DeveloperGarden_IpLocation($config);
364 $service->setEnvironment(
365 Zend_Service_DeveloperGarden_IpLocation::ENV_MOCK
367 $ip = new Zend_Service_DeveloperGarden_IpLocation_IpAddress('127.0.0.1');
368 print_r($service->locateIp($ip));
373 <sect2 id="zend.service.developergarden.localsearch">
374 <title>Local Search</title>
377 The Local Search service provides the location based search machine <ulink
378 url="http://www.suchen.de">suchen.de</ulink> via web service interface. For
379 more details, refer to <ulink
380 url="http://www.developergarden.com/static/docu/en/ch04s02s06.html">the
381 documentation</ulink>.
384 <example id="zend.service.developergarden.localsearch.example">
385 <title>Locate a Restaurant</title>
387 <programlisting language="php"><![CDATA[
388 $service = new Zend_Service_DeveloperGarden_LocalSearch($config);
389 $search = new Zend_Service_DeveloperGarden_LocalSearch_SearchParameters();
391 * @see http://www.developergarden.com/static/docu/en/ch04s02s06s04.html
393 $search->setWhat('pizza')
395 print_r($service->localSearch($search));
400 <sect2 id="zend.service.developergarden.sendsms">
401 <title>Send SMS</title>
404 The Send SMS service is used to send normal and Flash SMS to any number.
408 The following restrictions apply to the use of the SMS service:
414 An SMS or Flash SMS in the production environment must not be longer than
415 765 characters and must not be sent to more than 10 recipients.
421 An SMS or Flash SMS in the sandbox environment is shortened and enhanced by a
422 note from the DeveloperGarden. The maximum length of the message is 160
429 In the sandbox environment, a maximum of 10 SMS can be sent per day.
435 The following characters are counted twice:
436 <literal>| ^ € { } [ ] ~ \ LF</literal> (line break)
442 If a SMS or Flash SMS is longer than 160 characters, one message is charged for
443 each 153 characters (quota and credit).
449 Delivery cannot be guaranteed for SMS or Flash SMS to landline numbers.
455 The sender can be a maximum of 11 characters. Permitted characters are
462 The specification of a phone number as the sender is only permitted if the phone
463 number has been validated. (See: <link
464 linkend="zend.service.developergarden.smsvalidation">SMS Validation</link>)
469 <example id="zend.service.developergarden.sendsms.example">
470 <title>Sending an SMS</title>
472 <programlisting language="php"><![CDATA[
473 $service = new Zend_Service_DeveloperGarden_SendSms($config);
474 $sms = $service->createSms(
475 '+49-172-123456; +49-177-789012',
479 print_r($service->send($sms));]]></programlisting>
483 <sect2 id="zend.service.developergarden.smsvalidation">
484 <title>SMS Validation</title>
487 The SMS Validation service allows the validation of physical phone number to be used
488 as the sender of an SMS.
492 First, call <methodname>setValidationKeyword()</methodname> to receive an SMS
497 After you get your keyword, you have to use the <methodname>validate()</methodname> to
498 validate your number with the keyword against the service.
502 With the method <methodname>getValidatedNumbers()</methodname>, you will get a list
503 of all already validated numbers and the status of each.
506 <example id="zend.service.developergarden.smsvalidation.request.example">
507 <title>Request validation keyword</title>
509 <programlisting language="php"><![CDATA[
510 $service = new Zend_Service_DeveloperGarden_SmsValidation($config);
511 print_r($service->sendValidationKeyword('+49-172-123456'));
515 <example id="zend.service.developergarden.smsvalidation.validate.example">
516 <title>Validate a number with a keyword</title>
518 <programlisting language="php"><![CDATA[
519 $service = new Zend_Service_DeveloperGarden_SmsValidation($config);
520 print_r($service->validate('TheKeyWord', '+49-172-123456'));
525 To invalidate a validated number, call the method <methodname>inValidate()</methodname>.
529 <sect2 id="zend.service.developergarden.voicecall">
530 <title>Voice Call</title>
533 The Voice Call service can be used to set up a voice connection between two telephone
534 connections. For specific details please read the <ulink
535 url="http://www.developergarden.com/static/docu/en/ch04s02.html">API
536 Documentation</ulink>.
540 Normally the Service works as followed:
546 Call the first participant.
552 If the connection is successful, call the second participant.
558 If second participant connects succesfully, both participants are connected.
564 The call is open until one of the participants hangs up or the expire mechanism
570 <example id="zend.service.developergarden.voicecall.call.example">
571 <title>Call two numbers</title>
573 <programlisting language="php"><![CDATA[
574 $service = new Zend_Service_DeveloperGarden_VoiceCall($config);
575 $aNumber = '+49-30-000001';
576 $bNumber = '+49-30-000002';
577 $expiration = 30; // seconds
578 $maxDuration = 300; // 5 mins
579 $newCall = $service->newCall($aNumber, $bNumber, $expiration, $maxDuration);
580 echo $newCall->getSessionId();
585 If the call is initiated, you can ask the result object for the session ID and
586 use this session ID for an additional call to the <methodname>callStatus</methodname>
587 or <methodname>tearDownCall()</methodname> methods. The second parameter on the
588 <methodname>callStatus()</methodname> method call extends the expiration for this call.
591 <example id="zend.service.developergarden.voicecall.teardown.example">
592 <title>Call two numbers, ask for status, and cancel</title>
594 <programlisting language="php"><![CDATA[
595 $service = new Zend_Service_DeveloperGarden_VoiceCall($config);
596 $aNumber = '+49-30-000001';
597 $bNumber = '+49-30-000002';
598 $expiration = 30; // seconds
599 $maxDuration = 300; // 5 mins
601 $newCall = $service->newCall($aNumber, $bNumber, $expiration, $maxDuration);
603 $sessionId = $newCall->getSessionId();
605 $service->callStatus($sessionId, true); // extend the call
607 sleep(10); // sleep 10s and then tearDown
609 $service->tearDownCall($sessionId);
614 <sect2 id="zend.service.developergarden.conferencecall">
615 <title>ConferenceCall</title>
618 Conference Call allows you to setup and start a phone conference.
622 The following features are available:
628 Conferences with an immediate start
634 Conferences with a defined start date
640 Recurring conference series
646 Adding, removing, and muting of participants from a conference
652 Templates for conferences
658 Here is a list of currently implemented <acronym>API</acronym> methods:
664 <methodname>createConference()</methodname> creates a new conference
670 <methodname>updateConference()</methodname> updates an existing conference
676 <methodname>commitConference()</methodname> saves the conference, and, if no
677 date is configured, immediately starts the conference
683 <methodname>removeConference()</methodname> removes a conference
689 <methodname>getConferenceList()</methodname> returns a list of all configured
696 <methodname>getConferenceStatus()</methodname> displays information for an
703 <methodname>getParticipantStatus()</methodname> displays status information
704 about a conference participant
710 <methodname>newParticipant()</methodname> creates a new participant
716 <methodname>addParticipant()</methodname> adds a participant to a conference
722 <methodname>updateParticipant()</methodname> updates a participant,
723 usually to mute or redial the participant
729 <methodname>removeParticipant()</methodname> removes a participant from a
736 <methodname>getRunningConference()</methodname> requests the running instance of
743 <methodname>createConferenceTemplate()</methodname> creates a new conference
750 <methodname>getConferenceTemplate()</methodname> requests an existing conference
757 <methodname>updateConferenceTemplate()</methodname> updates existing conference
764 <methodname>removeConferenceTemplate()</methodname> removes a conference
771 <methodname>getConferenceTemplateList()</methodname> requests all conference
772 templates of an owner
778 <methodname>addConferenceTemplateParticipant()</methodname> adds a conference
779 participant to conference template
785 <methodname>getConferenceTemplateParticipant()</methodname> displays details of
786 a participant of a conference template
792 <methodname>updateConferenceTemplateParticipant()</methodname> updates
793 participant details within a conference template
799 <methodname>removeConferenceTemplateParticipant()</methodname> removes
800 a participant from a conference template
805 <example id="zend.service.developergarden.conferencecall.example">
806 <title>Ad-Hoc conference</title>
808 <programlisting language="php"><![CDATA[
809 $client = new Zend_Service_DeveloperGarden_ConferenceCall($config);
812 new Zend_Service_DeveloperGarden_ConferenceCall_ConferenceDetail(
813 'Zend-Conference', // name for the conference
814 'this is my private zend conference', // description
815 60 // duration in seconds
818 $conference = $client->createConference('MyName', $conferenceDetails);
820 $part1 = new Zend_Service_DeveloperGarden_ConferenceCall_ParticipantDetail(
824 'your.name@example.com',
828 $client->newParticipant($conference->getConferenceId(), $part1);
829 // add a second, third ... participant
831 $client->commitConference($conference->getConferenceId());
836 <sect2 id="zend.service.developergarden.performance">
837 <title>Performance and Caching</title>
840 You can setup various caching options to improve the performance for resolving WSDL and
841 authentication tokens.
845 First of all, you can setup the internal SoapClient (PHP) caching values.
848 <example id="zend.service.developergarden.performance.wsdlcache.example">
849 <title>WSDL cache options</title>
851 <programlisting language="php"><![CDATA[
852 Zend_Service_DeveloperGarden_SecurityTokenServer_Cache::setWsdlCache(
859 The <constant>[PHP CONSTANT]</constant> can be one of the following values:
865 <constant>WSDL_CACHE_DISC</constant>: enabled disc caching
871 <constant>WSDL_CACHE_MEMORY</constant>: enabled memory caching
877 <constant>WSDL_CACHE_BOTH</constant>: enabled disc and memory caching
883 <constant>WSDL_CACHE_NONE</constant>: disabled both caching
889 If you also want to cache the result for calls to the SecuritTokenServer
890 you can setup a <classname>Zend_Cache</classname> instance and pass it to the
891 <methodname>setCache()</methodname>.
894 <example id="zend.service.developergarden.performance.cache.example">
895 <title>SecurityTokenServer cache option</title>
897 <programlisting language="php"><![CDATA[
898 $cache = Zend_Cache::factory('Core', ...);
899 Zend_Service_DeveloperGarden_SecurityTokenServer_Cache::setCache($cache);