@@ -224,32 +224,38 @@ - (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayloa
224224 // Process the received push
225225 NSLog (@" didReceiveIncomingPushWithPayload payload = %@ " , payload.type );
226226 /* payload example.
227- {
228- "callkeep": {
229- "caller_id": "+8618612345678",
230- "caller_name": "hello",
231- "caller_id_type": "number",
232- "has_video": false,
233- },
234- "extra": {
235- "foo": "bar",
236- "key": "value",
237- }
238- }
227+ {
228+ "callkeep": {
229+ "uuid": "xxxxx-xxxxx-xxxxx-xxxxx",
230+ "caller_id": "+8618612345678",
231+ "caller_name": "hello",
232+ "caller_id_type": "number",
233+ "has_video": false,
234+ },
235+ "extra": {
236+ "foo": "bar",
237+ "key": "value",
238+ }
239+ }
239240 */
240241 NSDictionary *dic = payload.dictionaryPayload [@" callkeep" ];
241- NSString *number = dic[@" caller_id" ];
242- NSString *localizedCallerName = dic[@" caller_name" ];
242+ NSString *callerId = dic[@" caller_id" ];
243+ NSString *callerName = dic[@" caller_name" ];
243244 BOOL hasVideo = [dic[@" has_video" ] boolValue ];
244- NSString *handleType = dic[@" caller_id_type" ];
245-
245+ NSString *callerIdType = dic[@" caller_id_type" ];
246+ NSString *uuid = dic[@" uuid" ];
247+
248+ if ( uuid == nil ) {
249+ uuid = [self createUUID ];
250+ }
251+
246252 // NSDictionary *extra = payload.dictionaryPayload[@"extra"];
247253
248- [CallKeep reportNewIncomingCall: [ self createUUID ]
249- handle: number
250- handleType: handleType
254+ [CallKeep reportNewIncomingCall: uuid
255+ handle: callerId
256+ handleType: callerIdType
251257 hasVideo: hasVideo
252- localizedCallerName: localizedCallerName
258+ localizedCallerName: callerName
253259 fromPushKit: YES
254260 payload: payload.dictionaryPayload
255261 withCompletionHandler: ^(){}];
0 commit comments